4 ways to deal with overflowing text

Поделиться
HTML-код
  • Опубликовано: 13 июн 2024
  • Overflowing text is actually a feature of CSS, but it can feel like a pretty annoying one 😂. Depending on the situation, there are different ways we can deal with it though, so in this video I look at 4 different ways that could come in handy in different situations.
    🔗 Links
    ✅ Custom scrollbars: • Create custom scrollba...
    ✅ Container Query Unit support: caniuse.com/?search=container...
    ✅ More on container queries: • Container Queries are ...
    ✅ More on container query units: • New CSS Units! Contain...
    ⌚ Timestamps
    00:00 - Introduction
    00:50 - Why is this even happening
    01:20 - overflow-x
    01:40 - break-word
    02:21 - min-content and fit-content
    03:07 - container queries
    #css
    --
    Come hang out with other dev's in my Discord Community
    💬 / discord
    Keep up to date with everything I'm up to
    ✉ www.kevinpowell.co/newsletter
    Come hang out with me live every Monday on Twitch!
    📺 / kevinpowellcss
    ---
    Help support my channel
    👨‍🎓 Get a course: www.kevinpowell.co/courses
    👕 Buy a shirt: teespring.com/stores/making-t...
    💖 Support me on Patreon: / kevinpowell
    ---
    My editor: VS Code - code.visualstudio.com/
    ---
    I'm on some other places on the internet too!
    If you'd like a behind the scenes and previews of what's coming up on my RUclips channel, make sure to follow me on Instagram and Twitter.
    Twitter: / kevinjpowell
    Codepen: codepen.io/kevinpowell/
    Github: github.com/kevin-powell
    ---
    And whatever you do, don't forget to keep on making your corner of the internet just a little bit more awesome!

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

  • @felixcornelissen89
    @felixcornelissen89 Год назад +94

    Another good option is to add the ­ character where you would like the word to break. In this case you could have awe­some. It adds a hyphen if the word doesn't fit, but otherwise it's invisible

    •  Год назад

      woow!

    • @aram5642
      @aram5642 Год назад +5

      Equiv of (word break opportunity).

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

      Yes Kyle has made on it in WDS

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

      That’s so cool

    • @dripcaraybbx
      @dripcaraybbx Год назад +3

      But then you're coupling markup with presentation. We shouldn't have to pollute the content like this to account for or workaround limitations in the UI.

  • @aviralvikram9431
    @aviralvikram9431 Год назад +15

    This problem occurs many times in my projects and i don't how, but somehow Kevin always manage to predict what we need and what's most useful for us one by one.I really appreciate these super juicy knowledge you are sharing with us Kevin.
    You are filling that 20% knowledge gap which makes the difference between an intermediate, advance and Professional developers.

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

    That last bit about @container explains what container queries is better than some other videos I’ve seen on RUclips.

  • @rproctor83
    @rproctor83 Год назад +6

    Can't wait for container stuff to be more supported, it is like a dream come true.

  • @TheElkster
    @TheElkster Год назад +7

    Really great to see 'all' the options available! Thanks, Kevin!

  • @degenyakuza
    @degenyakuza Год назад +4

    Thank you so much Kevin for making css easier for us to understand

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

    This channel has so many tips and tricks, it is insane. KP, lord of html and css.

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

    I love your channel your energy makes the videos enjoyable regardless if I need the information right away ill watch it anyway for fun 😊😊

  • @bobross2404
    @bobross2404 Год назад +2

    Hope you're having a great day! thank you for all the awesome videos

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

    This is a sort of "Memebuster: css edition". As you seen on TV.... love it!

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

    your video pop-up when I want solution for my project .

  • @brainheap
    @brainheap 10 месяцев назад

    i just know CSS is awesome cause you are awesome
    without your valuable videos, i can't find out the beauty of CSS

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

    i feel excited while watching your videos and get some thing i didn't know

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

    This is awesome,
    Thank you Kevin

  • @PhilLesh69
    @PhilLesh69 20 дней назад

    I know this is a JavaScript solution, but I had one project where I finally gave up trying to deal with word wrapping on wildly varying length of text in some headings that I wrote a javascript function and attached a listener to page load that calculated the height of the element and if it was 2 times the line height it would reduce the font size by a percentage and recalculate until the element height was equal to or less than the line height. It was a little clumsy since a page would load with a heading that occupied more than one line and then users could see the heading change sizes really quickly and realign the element flow accordingly. So it was probably bad for page speed and other seo metrics. But it fixed that immediate problem at least.

  • @MrOliver1444
    @MrOliver1444 8 месяцев назад

    I love CSS thanks Kevin!

  • @user-rb8bv8hw3g
    @user-rb8bv8hw3g 8 месяцев назад

    I really Helpfull for your video,Thank you soo Much

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

    ❤man it helped me a lot thank you God bless

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

    you saved me thank you soooo much man

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

    beautiful, simple! keep it up ;)

  • @Jack-ss4re
    @Jack-ss4re Год назад

    3:40 that some god level shit

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

    Great and informative

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

    wow, that container thing is awesome

  • @alexdubkov6998
    @alexdubkov6998 12 дней назад

    Super content!

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

    Thanks for sharing

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

    another very useful content sir, thanks!

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

    Hey Kevin, I couldn't get this to post in your RUclips ideas section. Here recently I was trying to answer a question on how to set a margin on a item in a navbar that uses bootstrap classes, but when I got to looking at the documentation I got confused. I was wondering if you could make a video on the topic. I'm sure people n would want to watch it. Thanks again for the b work you do. It's appreciated.

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

    your awesome bro. U r very cool ma man. Keep it up

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

    Perhaps you should make an algorithm of your choice or so a poll on what improvements would be the easy way for ways to make it much easier to make a website/s. The whole CSS eco system seems very un-human-friendly and overly complicated. I'm sure you have some great ideas on ways to make the job much straight down.

  • @mohd-obid
    @mohd-obid Год назад

    Thank you ❤️

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

    i currently have this problem in a project, Thanks

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

    really nice thumbnail btw!!

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

    Hi Kevin! Can you do a short/video on how to create a flexbox container (with a max width and content centered) where a flex item (image) bleeds to the right of the viewport?

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

    very cool techniques. i watch your videos all the time and admire the solution. Unfortunately, just that I don't understand English very well ))) Because I am from Ukraine. But I try to learn English !) Thanks for the video!

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

    Another good video. Would shrinking font size be ok on mobile? Can you do more with container queries? Can It be used as an Articles container.

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

    That cqi is a game changer

  • @aram5642
    @aram5642 Год назад +2

    White spacing , word break... this is one of the things I always have to look up.
    And Chrome, please we are waiting for cq!

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

      They are in Chrome :D
      We're just waiting for Firefox now, and it's about to go into Nightly from what I understand!

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

    Yo Kevin you just hit 666k subs, congrats

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

    HeyKevin.. Waiting for Css Rocks

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

    Is it possible to add flexbox into an already existing code and modify the code accordingly?

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

    Careful with some of those. For WCAG 2,1 the user must be able to achieve 200% bigger font sizes without loss. Clamp can torpedo that as just one example.

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

      If font-sizes are set in rem (and the middle value in the clamp() includes a + rem value), it shouldn't cause any issues... I think 🤔

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

      @@KevinPowell there's some lovely work by Adrian Roselli on this is you care to deep-dive. Just thought I'd add the note for others because there are definite cases where issues exist.

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

      @@n_mckean I'll definitely look into it 👍

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

    I use ­
    Soft hyphen in HTML

  • @JB-fh1bb
    @JB-fh1bb Год назад

    @1:41 Ciao!

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

    how can i keep track of your content. Is there a code pen available for this?

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

    Overflow: ellipsis, Am I a joke to you?

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

    Hey Kevin,
    Can we know the SCSS course launch date please 🙏

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

    Please make a video how to make our page smooth scroll after adding heavy animations

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

    hi can you please make a design system with scss and make a website using that design system also use react

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

    ❤️❤️👍

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

    I forgot your name and searched for css king

  • @user-xv9bn2fe5c
    @user-xv9bn2fe5c Месяц назад

    0:51 problem right here, but the problem is in the left. oh you are talking about yourself. "kidding😂😂😂😂"

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

    i always use Tailwand for my css
    am i noob ?

  • @musteemustang3439
    @musteemustang3439 11 месяцев назад

    Please who can help me out with how to deal with overflow in carousel or slide images.

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

    i would just give span to that word and I am good to go. :)

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

    there is a fifth approach to solve this problem: use a *shorter word!* Also not perfect But hey it's a solution!
    happy thanksgiving 🎃🎃

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

      I've definitely done that before, lol

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

    Congratulations with 666k subs)))

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

    I will never understand why the SHY tag didn't get any real support in html.

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

    am i dumb or what nothing works on me :(

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

    wouldve been if you showed how to make the word cut of with a ... eg: This is too lo...

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

    css: container-type is yet not supported by Firefox........

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

      I know, I mentioned that browser support isn't great before going into how it works, and they're about to put it into Firefox Nightly, so it shouldn't be *too* much longer

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

    First! Hi Kevin

  • @user-gf9ri4wj5h
    @user-gf9ri4wj5h Год назад

    p {display: “none”}

  • @foxxo-dev
    @foxxo-dev Год назад

    22nd commenter ^^

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

    .kevin-powell { overflow: awesome; } 👈🤓