Block, Inline, and Inline-Block explained | CSS Tutorial

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024

Комментарии • 299

  • @timgehrsitz3267
    @timgehrsitz3267 4 года назад +44

    Halfway through this video I thought "ah this is all common sense I don't need this"
    Then you hit the inline block button and i needed exactly that to fix a problem with my Vue.js project for a client 😂

  • @julianapereira381
    @julianapereira381 3 года назад +9

    Kevin, I love you! I've been learning web dev for the past 8 months now and it's so frustraring sometimes how there are a number of excellent web developers who unfortunately turn out to be awful teachers lol
    Thanks for this video! You've just earned another subscriber!

  • @DaScribe100
    @DaScribe100 4 года назад +158

    Been wondering about this one for years, EXPLAINED at last. Thank you!

    • @mohit_narang113
      @mohit_narang113 3 года назад

      why did you check MDN docs

    • @osamasarhan6151
      @osamasarhan6151 3 года назад

      My question is , you just said we can’t give inline element a height but we do give the image a height and it’s an inline element

    • @amitkumargupta-
      @amitkumargupta- 3 года назад

      @@osamasarhan6151 As Kevin has mentioned, Images are not precisely inline or inline-block element but something called Replaced Elements

  • @iselaregain9301
    @iselaregain9301 3 года назад +75

    This makes my html & CSS class so much easier!! Thank you!

  • @ScottSW1990
    @ScottSW1990 4 года назад

    Great explanation! I was trying to move around a couple squares the other night and couldn't figure out why nothing was working. Thanks!

  • @travezripley
    @travezripley 4 года назад +3

    Kevin, the CRL class was great. I learned so much, it was informative and very efficient. Thank you! I look to taking on the Scrimba classes.

    • @KevinPowell
      @KevinPowell  4 года назад +3

      Glad it was helpful! I hope that you're enjoying the Bootcamp too!

    • @travezripley
      @travezripley 4 года назад

      Kevin Powell every class you have created is great, I look so forward to them. I have a huge fondness because of your enthusiasm, I feel your content and Web Designer Magazine... give me a future to look forward to. I find so much inspiration, and has helped me develop my style.

  • @Steve-yk4fu
    @Steve-yk4fu 4 года назад +42

    This was well done! . The explanations were great, examples on point, and even the amount of time was just right. 👍

    • @osamasarhan6151
      @osamasarhan6151 3 года назад

      My question is , you just said we can’t give inline element a height but we do give the image a height and it’s an inline element

  • @DinAmri
    @DinAmri 4 года назад

    Simple to follow and clear for a beginner. Thank You.

  • @Andrea-lf3jq
    @Andrea-lf3jq 4 года назад +13

    You seem like the nicest human being. Also quality teacher 👏 thanks for all the content.

  • @casperr3717
    @casperr3717 3 года назад +9

    05:07 at this moment he realized even the grand master can learn something new while teaching. XD

    • @osamasarhan6151
      @osamasarhan6151 3 года назад

      My question is , you just said we can’t give inline element a height but we do give the image a height and it’s an inline element

  • @crawfordvining4208
    @crawfordvining4208 4 года назад

    Great Video! Thanks for the link on the two value syntax for display. Good stuff!

  • @RamkumarGM-m7t
    @RamkumarGM-m7t Год назад

    Thanks dude.... Got a more knowledge about this thing

  • @danmiller7709
    @danmiller7709 3 года назад

    Clear and concise! Great content, quick and easy sub.

  • @rickfearn3663
    @rickfearn3663 4 года назад +15

    Outstanding clarity, Kevin. You are an excellent educator. Thank you, Rick

  • @earthycoin
    @earthycoin 4 года назад +13

    Kevin never stop posting the world needs you!

  • @BillyLoweBeauty
    @BillyLoweBeauty 3 года назад

    AWESOME VIDEOL FUNNY TO WATCH. THANKS FOR KEEPING SOME BLUNDERS IN. MAKES YOU AWESOME

  • @anwarislive
    @anwarislive 7 месяцев назад

    Amazing explanation, thanks :)

  • @gobideveloper111
    @gobideveloper111 4 года назад +15

    i am a beginner in web world little bit confused about inline and inline-block elements but now 100% completely understand that whole the elements how they are working .

  • @ToycarsaddictDaily
    @ToycarsaddictDaily 3 года назад

    Drop your CSS-fear...And suddenly disappear? = Display: None🤣👌

  • @dukeselwood
    @dukeselwood 4 года назад +6

    Great tutorial. This had really confused me and caused me lots of issues. I had not found this explained clearly anywhere else. Thanks!

  • @arpitkumar5821
    @arpitkumar5821 3 года назад +1

    Image is inline but But top and bottom margin margin work in that? Please explain I am wondering from six month. Thanks🙏❤

  • @rawdelicious
    @rawdelicious 3 года назад +3

    Finally the inline-block demystified! 15 years later!

  • @franciswoli2647
    @franciswoli2647 3 года назад +1

    You have really solved my problem with inline, block and Inline-block. thanks

  • @suri5023
    @suri5023 3 года назад +2

    anytime I forget something in CSS i search for Kevin's tutorials because I know that I will understand what he explains

  • @stilgharc
    @stilgharc 3 года назад +2

    The best underrated web dev channel I have seen so far. I'm dumb or slow learner but the way Kevin Powell explain the concept of Web Dev , I easily understood it. Sorry for my Broken English not my native language. I wish my instructor is the same good as you are Mr.Powell. I hope you get more subs.

  • @jackr9122
    @jackr9122 4 года назад +1

    Kevin! I'm trying to do work, stop making so many helpful videos!!

  • @ollyz2926
    @ollyz2926 4 года назад +8

    Note from this video(please correct me if i am wrong):
    Block: always set on top of each other, even has space on the right side of page, width is 100%;
    Inline: only take the width the content need even the same line has other content, don’t force a new line; cannot accept height and margin, because it doesn’t change the layout;
    Inline-block: works when inline element want to have padding, height or margin; don’t force a new line;

    • @ralphhuzz31
      @ralphhuzz31 4 года назад

      exactly very helpful learning this little things since these are fundamentals

  • @kuldeepadhikari3849
    @kuldeepadhikari3849 3 года назад +2

    amazing channel and amazing css explanation, I have been struggling with css tricks for so much time now but your videos make them easier to understand and why they behave in certain ways when I expect something else !

  • @insPIreMath
    @insPIreMath 2 года назад

    Great Video! But..........if you give a button a width (input element that is display:inline;) it shows up!!!!!!!! Why is that? Is it because they are replaced elements Kevin? Just like images?

  • @colindante5164
    @colindante5164 3 года назад +2

    I'm blown away how well you're able to articulate and explain things so clearly. Hats off to you Sir!! )))

  • @jaynetan6589
    @jaynetan6589 Год назад +1

    An amazing detailed explaination. Kevin is becoming my fav RUclipsr cuz he really brings in good value to us who has little to no money in RUclips & we can watch it for free. So grateful to have this man in RUclips. It's real dopee

  • @jonathanlopez5380
    @jonathanlopez5380 2 года назад +1

    Great video! I love your content Kevin. I have a question. Can you tell me why "transform" doesn't work on inline elements?

  • @amitkumargupta-
    @amitkumargupta- 3 года назад

    Thanks @Kevin.
    Anyone looking for notes:
    Q.1 - Block, Inline, and Inline-Block explained | CSS Tutorial
    *Block Level Element:*
    - width: 100%;.
    - Stack on each other vertically. (Enforces a new line)
    *Inline Level Element*
    - width: widthOfContent;
    - height does not work
    - margin top/bottom does not work
    - padding top/bottom does work (Layout wise)
    - height can be changed using font-size
    *Inline Block Level Element*
    - width: widthOfContent;
    - Goes one after another in a horizontal line.
    - We can set margin/padding on it.
    *Replaced Elements*
    - Images behave like inline-block elements but these are called replaced elements.

  • @WEBskie_pl
    @WEBskie_pl 2 года назад

    LOVE YOUR TUTORIALS and EXPLENATIONS!

  • @piromaniaco3579
    @piromaniaco3579 4 года назад +2

    Another awesome video from Kevin.
    You Conquering Responsive Layout course was amazing. I'm still working on the last final challenge. Really excited.
    Thank you for all! 💚

  • @dennisdecoene
    @dennisdecoene 2 года назад +1

    Well, I was in the same situation as some other comments. No other resource gave me a real good understanding about this rather fundamental concept. Thank you Kevin! I love your channel! ❤️

  • @kevinrusch3627
    @kevinrusch3627 2 года назад

    Thanks for explaining. However, every time you explain how these things work, I want to scream "WHY DID THEY DO IT THIS WAY???". I just don't get who thought this up and believed they were making a system that was clear, concise, or the most practical.

  • @Spacetime23
    @Spacetime23 9 месяцев назад

    Beautifully explained !!! Subscribing right now.... Wish you had some English captions as well for catching up with the speed meant for non-native Americans or British English speakers.

  • @adymorris7347
    @adymorris7347 5 месяцев назад

    Kevin - I'm afraid I am going to have to adopt you! Thanks so much for this explanation. I was really struggling with the concept, so - much obliged.

  • @evelynevervloesem437
    @evelynevervloesem437 6 месяцев назад

    Thank you so much for this great and simple video made just for what I needed 😀 I am a UX designer and enthousiast coder😅 Since I do not code on a regular basis I tend to forget everything I’ve learned in trainings but these kind of short to the point video really help jog up my memory and have those « ahaaa yeah now I remember » moments 😀 so thank you for that!

  • @guillermomoreira5601
    @guillermomoreira5601 2 года назад

    You have the answer to every question about CSS that I have, you're something like the "CSS Wikipedia" for me!

  • @ihsanerayketenci
    @ihsanerayketenci Год назад

    Here is a positive feedback my firend. I did not understand a clear thing because you are giving extra extra informations between your sentences. It works for me like his -> just say what happens when you do bla bla and it works tike this because bla bla. I mean i need the topic to be simple as possible. Personally i do not need much jokes, not need extra coverage about recent trends or any extra info. I just need the root and then i can learn quickly and easily so that makes me love your videos and continue following. Thanks for lessons. Best Luck.

  • @maheephoenix4398
    @maheephoenix4398 2 года назад

    I am still a little confused about how can I use the property but I guess I need practice. Also, thank you so much for the CSS comment shortcut (Command +/) it was the most annoying thing to type in every time.

  • @savidya__
    @savidya__ 2 года назад

    Thanks heaps! I've been reading article after article about this and couldn't understand a thing. You made me move forward. 🙏

  • @aliata9154
    @aliata9154 2 года назад

    my native language isn't english and I love how you say the word "OUT". I don't know where you from but it is funny to me. :DD

  • @marco7838
    @marco7838 2 месяца назад

    When I create a p tag and double click on it, in the browser. It takes up a lot of space than it should. Maybe because it is a block level element that when I double click the blue space is quite big. How can I contain this and minimise the amount of space an element takes up?

  • @marco7838
    @marco7838 2 месяца назад

    When I create a p tag and double click on it, in the browser. It takes up a lot of space than it should. Maybe because it is a block level element that when I double click the blue space is quite big. How can I contain this and minimise the amount of space an element takes up?

  • @sakshamkapoor5905
    @sakshamkapoor5905 4 года назад +3

    Amazing! So well explained ❤

  • @carbellsarfo
    @carbellsarfo 4 года назад

    Great. this explains the reason behind some abnormal behaviours i come accross

  • @mpgrewal00
    @mpgrewal00 2 года назад

    Its amazing to see how someone who posts useful nerdy content gets only half a mil subs whereas someone who does some crazy things like outdoor cooking or stupid dance jumps gets few million. Intelligence is an underappreciated asset in a world full of stupidity.

  • @mrniamster
    @mrniamster 4 года назад

    Yesterday I spent 2 hrs and the solution was inline block wow 😑💜💁 thanks man

  • @naram07
    @naram07 Год назад

    Thank you!! I just came from a really confusing article which only makes sense now after watching this.

  • @joespinelli3604
    @joespinelli3604 3 года назад

    Would a correct way to think about inline-block be: You get to set the values of a block element with the display of an inline element?

  • @muhanad102
    @muhanad102 3 года назад

    How can I make a list of strings to be Inline and to look like a normal text block. Span tag didn't work with long strings and it kept showing missing text. I think with inlineblock the problem is if the text can't fit in the available space the whole text will go into a new line.

  • @rinokamura1152
    @rinokamura1152 4 месяца назад

    you teach good but ..... your expressions make me uncomfortable .....

  • @Horrented
    @Horrented Год назад

    Finally understood! Gosh thank you so much lol was stuck on this part of my course

  • @das_evoli
    @das_evoli 2 года назад

    lol finally i understand why some elements do not work with height or margin-top. It would always make me crazy

  • @romanext921
    @romanext921 3 года назад

    At 11:55, I wished you talked about the whitespace between the elements. It seems that if these a tags are written without any newlines or tabs or spaces, this little gap goes away. It annoyed me for hours.

  • @abdishakur2489
    @abdishakur2489 4 года назад +1

    Easy explanation on these three confusing elements. Thanks bruh

  • @Doraphobic
    @Doraphobic Год назад

    Thank you so much for this. Been binge watching your videos, you are a life savior

  • @ahmadmuqadas78
    @ahmadmuqadas78 Год назад

    not only i learned inline-block but i understand why margin:top never wroks

  • @Lolex1
    @Lolex1 7 месяцев назад

    a better approach to comment blocks in VSC would be to use the Shift+Alt+A shortcut

  • @BloodyClash
    @BloodyClash 4 года назад

    actually you COULD manipulate those invisible lines by creating a modified DOM. PHP can do that (yes - i always prefer PHP over Javascripty bipty). 😁so if you would wanna destroy all convetions you would be able to do that.

  • @mindmynotes8851
    @mindmynotes8851 3 года назад

    how did you transitioned your webcam from full size to small circle when video started?

  • @carberi50
    @carberi50 2 года назад

    Finally found the answer why the button I created was working the way it was.

  • @osamasarhan6151
    @osamasarhan6151 3 года назад

    My question is , you just said we can’t give inline element a height but we do give the image a height and it’s an inline element

  • @priyadharshanravichandran4483
    @priyadharshanravichandran4483 3 года назад +1

    You're are a lifesaver man, idk why no one took the time to explain it as patiently as you did, since it's really intuitive if taught in the right way. People just say so we add block so we can give padding but never fully explained the reasoning.

  • @his_deliciousness
    @his_deliciousness 2 года назад

    Great explanation. But couldn't help noticing you got a big head😅

  • @tsutsuji1164
    @tsutsuji1164 9 месяцев назад

    I really wanted to know why not block but inline-block when I use button, thank you!!!

  • @saeednrzadeh4754
    @saeednrzadeh4754 2 года назад

    Thanks for this video , What is the best method to move that button in to the center of the page when it is inline block ?

  • @poonamt
    @poonamt 2 года назад

    thank you so much!
    I was really confused but now I understand :)

  • @parampreetrai7093
    @parampreetrai7093 3 года назад

    Great video. Thanks for Ctrl + /. Really 🙂

  • @novanoskillz4151
    @novanoskillz4151 4 года назад

    outstanding explanation... new subscriber!!

  • @kemal6039
    @kemal6039 3 года назад

    Have I become color blind or that "red" outline on the paragraphs are orange?

  • @zorkon08
    @zorkon08 3 года назад +1

    I can't even tell you how much stress this would have saved me had I known this 6 months ago. Thanks for great videos!

  • @tofulosophy
    @tofulosophy 4 года назад +1

    I love your videos! Keep em coming!

  • @emkisn
    @emkisn 4 года назад +1

    awesome video! i always watch all the videos even though this a beginner content, congratulations on the incredible work.
    a nice video idea that would be very useful is "when to use rem and px" is always a difficult subject

  • @SteveRunciman
    @SteveRunciman 2 года назад

    finally, after all these years, I understand...thank you!

  •  4 года назад

    Very well explained. Thanks for the video.

  • @kaokaoylan4510
    @kaokaoylan4510 2 года назад

    Thanks so much Kevin!
    Well, I had to have watch the last part of the video in 0.75speed, because inline and in the line and inline-block are quite hard to differentiate when you finishing so fast

    • @kaokaoylan4510
      @kaokaoylan4510 2 года назад

      I found that , inline-block allows block-level elements to be placed side by side also with adjustable height properties.

  • @vasyaqwe2087
    @vasyaqwe2087 2 года назад

    This is so well explained, thank you!

  • @mohammadmehdiemamhdi1192
    @mohammadmehdiemamhdi1192 2 года назад +1

    nice👌👍

  • @johndrichardson2talks733
    @johndrichardson2talks733 3 года назад

    Sir Kevin, you are great! Thanks

  • @aftabaliali2703
    @aftabaliali2703 3 года назад

    Good explannationg........Thankyou sir!!!

  • @tommy10436
    @tommy10436 Год назад

    Thanks dad, your videos are excellent.

  • @smalltimer666
    @smalltimer666 2 года назад

    Hi, thank you. This was great! I have a problem that I can't really seem to solve: how does one avoid addition of spaces between inline elements? I have a tag with tags inside it. Something like: A list of links: L1, L2, and L3.. This is rendered with spaces in front of the comma and the full-stop. I don't understand why, and how do I make it stop doing that? :(

  • @yepp9643
    @yepp9643 3 года назад

    thank you so much! Now I truly understand them!

  • @khaihoang7420
    @khaihoang7420 3 года назад

    why does "link/button" start on a new line? it is just an inline element.

  • @polarpalmwv4427
    @polarpalmwv4427 2 года назад

    I am noticing that you use a // before some tags and it makes that line inactive. How does that work? I hadn't seen that before, which isn't surprising because I am new, but I tried using that on my practice code and it didn't do anything.

    • @KevinPowell
      @KevinPowell  2 года назад

      It's commenting them out, since I'm writing SCSS, you can do single line comments like that. If it was a regular CSS file, it would have just been toggling /* text here */ - in VS Code you can hit ctrl + / (or cmd on mac)

  • @RB-cx3ce
    @RB-cx3ce 2 года назад

    Thank you Thank you Thank you. I am currently going through TOP's courses but I can see myself watching your videos for years to come! so again, THANK YOU!

  • @abdullahbukhari1469
    @abdullahbukhari1469 2 года назад

    Waaaaaaaoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooow! Thanks Sensei !

  • @marionwatkins8897
    @marionwatkins8897 4 года назад

    You are such a darling. I like the fact that you always over explain things in general...and you know what? That benefits me. Don't change. Now, you have sparked up something else in my mind. Replaced Elements. I thought I subscribed a long time ago. Here's to You!! #muchappreciated.

  • @zakariabenfikri8092
    @zakariabenfikri8092 3 года назад

    @7:52 what is the shortcut that you use to turn off the elements, thanks!

  • @cheaterman49
    @cheaterman49 2 года назад

    Great video! I'm a bit surprised where you went with inline-block ; indeed, I liked how you described blocks as having a mandatory line break after them no matter their set width, and I thought you would simply describe inline-block as being the same as a block just without the implicit line break ; is there any reason you didn't go for it? Perhaps it's not as good a mental model as I'm thinking right now? While your practical examples are great, I remember doing layout with inline-block back in the day, so we usually downgraded a block to inline-block instead of upgrading an inline to inline-block, if that makes sense. Of course nowadays flex is king :-)

  • @joaocoelho2929
    @joaocoelho2929 4 года назад +1

    First

  • @jiwachhetri9262
    @jiwachhetri9262 2 года назад

    This guy's knowledge is another level

  • @11nolaboi
    @11nolaboi 2 года назад

    This was very helpful thank you!

  • @masteryourownway
    @masteryourownway 3 года назад

    Hello Kevin, do you have a video like that to inline with pictures? i can't a stuck with that

    • @KevinPowell
      @KevinPowell  3 года назад

      If you need images next to each other, they're inline by default.

  • @austin4855
    @austin4855 5 месяцев назад

    These lessons are incredible. You have a specific way of teaching using live troubleshooting and clear communication, and you seem to have a knack for explaining just enough theory along with the practice to be helpful and not overwhelming. I've seen a few of your videos now and they have done more to help me develop a quick CSS intuition than any other content.

  • @paulmozeley4473
    @paulmozeley4473 7 месяцев назад

    Thank you!! This helps make a lot of sense of the 3.