Discord Made The Coolest CSS Only Input Animation

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

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

  • @WebDevSimplified
    @WebDevSimplified  Месяц назад

    CSS Simplified: courses.webdevsimplified.com/css-simplified/?G052uyQw&coupon=CSS

  • @waleedbinalim
    @waleedbinalim Месяц назад +184

    Project lead: iT's jUsT aN iNpuT, wHy wOuLd yOu nEeD mOrE tHaN a MiNuTe fOr tHe TaSk?
    Developers:

    • @Astro-Francois
      @Astro-Francois Месяц назад +16

      Those fancy CSS elements are like a degree, higher ups wonder why it takes so long but complain when it's not there 🤣

  • @tekz541
    @tekz541 Месяц назад +28

    The last time I really worked with CSS was more than 10 years ago, it's really amazing to see that css can easily replace almost 90% of javascript ui code

  • @Tarabass
    @Tarabass Месяц назад +24

    Love this. Way better then "Stop this" or "stop that" video's :)

    • @anterpants
      @anterpants Месяц назад

      Not a fan of the stop this videos, but the stop that videos are 🔥

    • @braoha123
      @braoha123 Месяц назад +1

      Agreed, that is super stressful!

  • @donniedamato
    @donniedamato Месяц назад +27

    I'd avoid using positioning to place the elements where possible in favor of grid placement instead. Positioning introduces stacking contexts where elements might appear on top of each other in unexpected ways. Additionally, I'd use font relative units for icons so they scale with the text it is associated with. This would mean using `em` instead of `rem` for the size.

    • @theo-k4i8m
      @theo-k4i8m Месяц назад +2

      I get the font one, but I never had issues with positioning(yeah it can be tricky sometimes), can you just explain how something like in the video can be done with grid placement

    • @ankitpatel6845
      @ankitpatel6845 Месяц назад

      ​@@theo-k4i8mby using grid template areas. Recently wes bos created an short video on this.

  • @danielassayag1484
    @danielassayag1484 10 дней назад

    congrats, you kept both pace and clarity, this is impressive, ill really think of following your course.

  • @arkemiffo
    @arkemiffo Месяц назад +2

    I've used the placeholder-shown quite a long time now for my inputs. I use an empty space as the placeholder, and then a the label is being positioned inside the input as the placeholder. This allows me to keep the label visible when there's text in the input, but usually minimised to a much smaller font-size and moved to the top:0px of the input. That way you always have the name of the input shown, but when used, it's being moved off to the side with a transition, and you keep the accessibility automatically as you're using the label. Besides I think it looks great (in most cases anyway...)

  • @clevermissfox
    @clevermissfox Месяц назад +14

    Have been using this kind of pattern a lot with inputs in the last year. I mostly use the input-wrapper , the input inside , then pseudo element with a bg image of the icon, or the input + button > icon . And use grid or flex on the wrapper.
    I love the placeholder shown pseudo class , then I use the :has(input:focus) to put the outline around the wrapper (not sure why he turned off the outline just to use a box shadow though; the outline doesn’t take up space either). If it’s an icon not a button , then I use :focus-within.
    Then I can animate the width of input or flex-grow on the wrapper. :has(input:focus) outline then highlights the wrapper when the input is focused but still highlight the focus ring on the button when it’s focused. Also some fun timing functions to transition that width!
    I love css, and all the selectors and pseudo classes we have. There are so many ways to approach the same result !! Love a css video!

    • @deadlyecho
      @deadlyecho Месяц назад +2

      Same I use flex-grow as well, much better.

    • @PicSta
      @PicSta 11 дней назад +1

      Absolutely agree, the box-shadow as a replacement for an outline was unnecessary as outline behaves like it already. Only border takes width and causes ugly layout shifts.

  • @MrZerosixZeroone
    @MrZerosixZeroone Месяц назад +114

    wow, finaly someone discovered that you can target the focus state of an input 👏👏👏

    • @chihuhahuana4863
      @chihuhahuana4863 Месяц назад +6

      for real, title is actually kinda baity

    • @mikescholz6429
      @mikescholz6429 Месяц назад +1

      :has(:focus-within) 😎

    • @Hiru666
      @Hiru666 Месяц назад +7

      well, to me the interesting part of this is actually the ':placeholder-shown' pseudo-class, I personally had no clue that was a thing and would 100% have used some conditional rendering in JS to display each icon.
      ofc if you already knew about that then I don't see why you'd keep watching after seeing what was gonna be shown in the first place.

  • @sokzpieprzu
    @sokzpieprzu Месяц назад +5

    Right as I'm watching this, my discord search bar got split up into two rows and has no background. Well done Discord!

  • @pierwszywolnynick
    @pierwszywolnynick Месяц назад +4

    this gets complicated really fast. I can just imagine how it looks like for someone who's not tracking css changes for a while

  • @SK-vg3mw
    @SK-vg3mw Месяц назад +3

    Awesome! Thank you Kyle!

  • @vinayakporwal9885
    @vinayakporwal9885 Месяц назад +6

    that descrete property is something i have never read about in last 3 years of my learning damn 😮

    • @clevermissfox
      @clevermissfox Месяц назад +4

      It’s fairly new and not fully supported but a good progressive enhancement !
      Edit: Just got to this part of the video , I’ve always seen it as “allow-discrete”. Would have to pop onto the dev tools to see if “discrete” is valid but if so that’s great to know

  • @softmerit25
    @softmerit25 Месяц назад +1

    Wow, this is really cool. Thanks 👍

  • @luca.pettinato
    @luca.pettinato Месяц назад

    I like the video and modern CSS, as always Kyle is spot on! 👌🏻 Thank you!

  • @zakir.nuriiev
    @zakir.nuriiev Месяц назад

    Thanks for a nice video!

  • @AntonYefremov
    @AntonYefremov Месяц назад +1

    Great video, thank you!
    Though It still would be nice to see how the x-button could be wired to clear the input without JavaScript

  • @braoha123
    @braoha123 Месяц назад

    Really cool examples of css features that were completely new to me! Now while you can do a lot of cool things with just complex CSS-selectors, the readability is just awful when you put a bunch of them together like that.. so sticking to js and toggling classes with proper names is still the way to go IMO. But awesome showcase of what can be done with just CSS and HTML alone!

  • @khaledMohamed-tp4wx
    @khaledMohamed-tp4wx Месяц назад

    Great video, Thanks

  • @michelaveline
    @michelaveline Месяц назад

    Always amazing

  • @notarealperson9709
    @notarealperson9709 Месяц назад +12

    this is only for a product that has made it. so many teams want to build this shit before the product is even successful, ultimately dooming the project contributing to the large % of software products that fail.

    • @hackbaba999
      @hackbaba999 Месяц назад +4

      Exactly, they get lost in the sauce (aesthetics)

    • @int4_t
      @int4_t 27 дней назад

      bro who wants to use a php 2001 looking site

  • @Yamo406.x
    @Yamo406.x Месяц назад

    Sick, today I learned

  • @srdjagunjic
    @srdjagunjic Месяц назад +1

    OMG Firefox finally supports :has!
    Last year I wrote bunch of CSS to handle all sorts of things in a form using :has many times, only to get a feedback that it does not work on Firefox... I forgot to check before going that route.
    To fix it, I had to write JS that I was not really looking forward as I always prefer CSS based solutions.
    Now I see they finally support it since December last year.
    Interesting how you added support for IE but IE does not support :has which means that the main animation won't even work

  • @avi12
    @avi12 Месяц назад +1

    12:08 But is it hidden from the accessibility tree as well?

  • @kaslmineer7999
    @kaslmineer7999 Месяц назад +1

    really cool

  • @souvikmishra5323
    @souvikmishra5323 Месяц назад +3

    the full version!!

  • @clevermissfox
    @clevermissfox Месяц назад +2

    What is the keyboard shortcut to hop to the end of the “word” you’re on, not the whole line ?
    Eg at 16:14 when he is adding the :not() and jumps the cursor to the end of ”placeholder”, then one more jump to the end of “shown”?

    • @7orivorian141
      @7orivorian141 Месяц назад +5

      Ctrl+Left/Right Arrow to jump over a word. Holding shift will jump the word & select it.

    • @clevermissfox
      @clevermissfox Месяц назад +1

      @7orivorian141 you're a rock star, thank you.

  • @WePiphany
    @WePiphany Месяц назад +1

    Outline should be used instead of box shadow. Outline does not take up space.

  • @0xtz_
    @0xtz_ Месяц назад +2

    😮 interesting

  • @User948Z7Z-w7n
    @User948Z7Z-w7n Месяц назад

    I just bought your course

  • @itsfolf2
    @itsfolf2 29 дней назад

    Your version is actually better than Discord's, theirs is all javascript

  • @charlymarchiaro
    @charlymarchiaro Месяц назад

    Very nice, I love this. If the input text is long enough, won't it be displayed behind the icon?

    • @Tarabass
      @Tarabass Месяц назад +1

      Yes, it will. When icon is visible a larger padding on the right will fix it I guess..

    • @WebDevSimplified
      @WebDevSimplified  Месяц назад +2

      Whoops. I forgot to include that in this version of the code. I have it in the final version of the project csssimplified.netlify.app/22-discord-clone/after
      If you want you can take a look at the code here using dev tools to see what needs to be added for padding.

    • @charlymarchiaro
      @charlymarchiaro Месяц назад

      @@WebDevSimplified Great! Thank you

  • @N0TZ3R0
    @N0TZ3R0 Месяц назад

    CSS is really crazy

  • @ac5402
    @ac5402 Месяц назад +1

    The x button does not working any more, does it? unless we write js to handle this?

    • @WebDevSimplified
      @WebDevSimplified  Месяц назад +1

      That is correct. You could either add JS to make it work or you could wrap the input in a and use a for the X button.

  • @The14Some1
    @The14Some1 Месяц назад

    The other issue is that in your current setup the input may overlap those buttons, because you forgot to adjust it's right padding.

    • @WebDevSimplified
      @WebDevSimplified  Месяц назад +1

      Whoops. I forgot to include that in this version of the code. I have it in the final version of the project csssimplified.netlify.app/22-discord-clone/after
      If you want you can take a look at the code here using dev tools to see what needs to be added for padding.

  • @The14Some1
    @The14Some1 Месяц назад +10

    13:10 i wouldn't use "has" without necessity. It's a relative new selector and there might be users who haven't updated their browsers yet.
    You may use sibling selectors here: input:not(:placeholder-shown) + button>.search-icon

    • @stepans2167
      @stepans2167 Месяц назад +11

      :has is not as new as it used to be :)

    • @The14Some1
      @The14Some1 Месяц назад

      ​@@stepans2167 Just one year has passed after it was implemented in firefox.

    • @DrMxy
      @DrMxy Месяц назад +8

      Don't care about users who haven't updated their browsers in over a year.

    • @AntiAtheismIsUnstoppable
      @AntiAtheismIsUnstoppable Месяц назад +1

      Depends on the aim with your application, I think. I already use nested CSS, which is newer than :has and will break everything if not supported anyways, but I do agree that in some cases, using the older and tested techniques can be better, for backwards compatibility and for readability too. It can have changed since last time I researched some years ago, but TV apps could be where you would want compatibility rather than flexibility. I don't know how often SMART TVs update their browser engine?

    • @AntiAtheismIsUnstoppable
      @AntiAtheismIsUnstoppable Месяц назад

      I mean, if your user base is _everyone_ you probably have to look at backwards compatibility. You can use something like netrenderer which is an onlince service were you can quickly test your site in IE5.5-11. If it works in IE11, it probably also works on most other older browsers. As I remember, IE11 was quite standard compliant.

  • @rizkiacry
    @rizkiacry Месяц назад

    when you paid by the hour and not by the job:

  • @JoseCarballosa
    @JoseCarballosa Месяц назад

    How would you avoid targeting all buttons? [10:15]

  • @kipchickensout
    @kipchickensout Месяц назад

    wait.. I don't do webdev and even I knew that
    title baited me ngl

  • @seanperez1210
    @seanperez1210 Месяц назад

    Looks like googles material focus-ring … or tailwind with placeholder shown. Cool nonetheless the less

  • @MeganovaLP
    @MeganovaLP Месяц назад +1

    Yayy 🤣

  • @geoblk3000
    @geoblk3000 Месяц назад

    What do you use for the local web server? I see 127.0.0.1:5501 address.

    • @shirosfx_8202
      @shirosfx_8202 Месяц назад

      That's VSCode extension live server. You can see it at bottom-right of VSCode, before "Spell"

  • @kameroongod
    @kameroongod Месяц назад

    Proper but is the blue outline a personal choice? My discord has none.

    • @WebDevSimplified
      @WebDevSimplified  Месяц назад

      If you use the tab key to interact with elements they have a blue outline in Discord.

    • @kameroongod
      @kameroongod Месяц назад

      @ you are right i tried it now

  • @nomadshiba
    @nomadshiba Месяц назад +15

    instead of width/height/top/bottom/left/right
    i would prefer block/inline/start/end etc. so you can change directions easily.
    for example inline-size instead of width
    or inset-inline-start instead of left
    margin-block-end instead of margin-bottom. and other similar stuff.

    • @treyt7914
      @treyt7914 Месяц назад +5

      I disagree because those properties are much harder to read/understand

    • @waseksamin3216
      @waseksamin3216 Месяц назад

      it depends on personal preference. For instance I would use width instead of inline-size. But some other person would use inline-size instead of width. So it is personal choice. No one cares about what you use as long as you get the desired output.

    • @Kitulous
      @Kitulous Месяц назад

      would you make your search box vertical for this to matter?

    • @justsample9185
      @justsample9185 9 дней назад +1

      how often do you change directions?

  • @omaranbazna9066
    @omaranbazna9066 Месяц назад +2

    Can you teach us how to build real time database in css?
    With some machine models on top of it

  • @lyssenkoalex
    @lyssenkoalex Месяц назад

    🎉🎉❤

  • @amiller200
    @amiller200 28 дней назад

    Highly doubt Discord builds their client in CSS and HTML

  • @Rsh_technical
    @Rsh_technical Месяц назад +4

    Who uses plain css
    Talwind is used much

  • @pratik_dev
    @pratik_dev Месяц назад

    Misleading video title. Used HTML as well

  • @nowatcher123-g5f
    @nowatcher123-g5f Месяц назад

    Nice vid. But x button would not really work, and using :has and :not selectors is not a great way to write css. Sure, its modern, but support of these selectors are lacking, so it would be better if you can teach both using and not using these selectors

    • @WebDevSimplified
      @WebDevSimplified  Месяц назад +1

      :has has been supported in all modern browsers since 2023 and :not has been supported since 2020. There is no reason not to use these features. Grid and Flexbox for example have less than 1% more support that :not and all these properties (including :has) have greater than 94% support.

    • @nowatcher123-g5f
      @nowatcher123-g5f Месяц назад

      @@WebDevSimplified hmm, interesting. perhaps i'm getting old and not keeping up with trends :) just some time ago I tried using :has and it was already not working somewhere even I was using. but as others mentioned, these features could be avoided in favor of all and more well-supported ones. they're nice to teach, but with a cautionary tale of having new nice DX abstractions. thank you for your work, Kyle

  • @Audulf-of-Frisia
    @Audulf-of-Frisia Месяц назад +3

    Why do you shake your head so much when talking?

    • @jackmarrow6445
      @jackmarrow6445 Месяц назад +6

      Because he is from India

    • @benjen5518
      @benjen5518 Месяц назад +2

      What answer are you expecting from him?

    • @potatovision
      @potatovision Месяц назад +1

      Such a weird question... Sometimes it's okay to not act on every thought that comes into mind

    • @The14Some1
      @The14Some1 Месяц назад +1

      Why your avatar's triangles are crossed like that, tho?

    • @SogMosee
      @SogMosee Месяц назад

      autism