Custom select menu - CSS only

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ธ.ค. 2024

ความคิดเห็น • 194

  • @RANKKY9
    @RANKKY9 4 ปีที่แล้ว +98

    Kevin: pointer-events: none;
    Me: 🤯🤯🤯

  • @kenny123451
    @kenny123451 4 ปีที่แล้ว +62

    Thank you!
    pointer-events:none; Is a lifesaver!
    In my current project, I started to write Js to make stuff at the background clickable.... :D You saved me a lot of hours!

  • @TomAinsworth94
    @TomAinsworth94 ปีที่แล้ว +1

    I’ve struggling to get something like this together at work today, and your video is perfect to get me started! Thanks as always Kevin

  • @andriilukianenko8106
    @andriilukianenko8106 3 ปีที่แล้ว +2

    I don't think I will ever be able to fully comprehend CSS, but Kevin's content makes me feel I know some tips and hacks :D

  • @mrabhijitrabha
    @mrabhijitrabha ปีที่แล้ว +1

    pointer-event: none; made my day, thank you master ❤️

  • @mostafagh3573
    @mostafagh3573 ปีที่แล้ว

    you saved my day and my mental health in one move, god bless you .

  • @bijayaadhikari442
    @bijayaadhikari442 4 ปีที่แล้ว +1

    Scrimba is great, not just to learn, practice every moment.

  • @md.mirazuddin364
    @md.mirazuddin364 3 ปีที่แล้ว

    Thanks again for making such incredible video.
    pointer-events: none. that was a life saver.

  • @yitzchaksviridyuk932
    @yitzchaksviridyuk932 3 ปีที่แล้ว

    Appreciate your content so much that I don't skip a lot of the ads on your videos. 😄

  • @pablowbk
    @pablowbk 4 ปีที่แล้ว +3

    I came for the tshirt, stayed for the content 😎

  • @khalilmahmoodiyan975
    @khalilmahmoodiyan975 ปีที่แล้ว

    Awesome. I was looking for this for many days

  • @kiliusz
    @kiliusz 4 ปีที่แล้ว

    pointer-events: none
    Very nice tip.

  • @arsaurabh6044
    @arsaurabh6044 2 ปีที่แล้ว +1

    This was a cool video. Learned a lot. And that border trick was pretty neat.

  • @s.fofandi
    @s.fofandi 4 ปีที่แล้ว +1

    I did a similar custom select input on one of my project another thing you can do when doing something like this is have an SVG with your up and down arrows and use that as the background of the select element. then with repeat: none, position: right, and size: 100% auto, you can place it to the right. this prevents you from having multiple classes and an extra dom element for an effect like that. that being said OBVIOUSLY there are 1001 ways of doing whatever you want in CSS (that pointer-events thing was brilliant)

  • @MohammadAbdulHyeShaon
    @MohammadAbdulHyeShaon 4 ปีที่แล้ว +5

    Excellent...Go Ahead my dear....

  • @zvelkimD
    @zvelkimD 4 ปีที่แล้ว

    Super! Always nice to see even experts have trouble with top and translate properties :D

  • @ThiagoVieira91
    @ThiagoVieira91 4 ปีที่แล้ว +27

    Me: "WTF!? How I'm going to build this context tooltip? The icon is messing everything!"
    Kevin: pointer-events: none;
    Me: 🤯

  • @Avinash.i1Brand
    @Avinash.i1Brand 2 ปีที่แล้ว

    You saved my time by pointer events property. Thank you Kevin. Much love 💕

  • @abnerwillys
    @abnerwillys 4 ปีที่แล้ว +1

    Amazing video man. I'm a Dev jr on stack JS, and this video helps very much. Thanks and best regards from Brazil.

  • @captaindesign
    @captaindesign 4 ปีที่แล้ว +1

    Excellent tutorial, thanks Kevin!

  • @bishwajitsarkar8873
    @bishwajitsarkar8873 ปีที่แล้ว

    it's a real helpful.Thank you sir, for the tutorial.

  • @mke7605
    @mke7605 4 ปีที่แล้ว +4

    On firefox this doesn't seem to behave. Setting the color for the select results in Firefox on my machine in in a nicely colored object, but the option list is still white. On Chrome it behaves like expected though.

  • @elvingonzalez8932
    @elvingonzalez8932 8 หลายเดือนก่อน +2

    Please. how to change the blue background hover option??

  • @Markor91
    @Markor91 2 ปีที่แล้ว

    It works like a charm, thank you!

  • @c__beck
    @c__beck 4 ปีที่แล้ว +2

    You have the best shirts, Kevin!

    • @KevinPowell
      @KevinPowell  4 ปีที่แล้ว +2

      Thanks, this is def. one of my favourites :)

    • @BloodyClash
      @BloodyClash 4 ปีที่แล้ว

      oooh. just noticed...is that a zelda shirt ?

    • @c__beck
      @c__beck 4 ปีที่แล้ว

      @@BloodyClash it is!

    • @BloodyClash
      @BloodyClash 4 ปีที่แล้ว +1

      @@c__beck Cool. I love Zelda Stuff (maybe not the biggest fan in the world but still love it)

  • @AjayKumar-pn5yy
    @AjayKumar-pn5yy 2 ปีที่แล้ว

    You are awesome Kevin ❤️❤️❤️

  • @ChillCityNaveen
    @ChillCityNaveen 4 ปีที่แล้ว

    Awesome trick to create triangles thanks kevin:)

  • @DavidAshby1
    @DavidAshby1 3 ปีที่แล้ว +7

    Hi Kevin, thanks for another great tutorial. I have one question though. When I put the dropdown in a container that spans the full width of the screen the custom arrow moves to the far right of the screen so I have ended up creating another container within to hold the dropdown which keeps the elements together (although we have done positioning relative and absolute). Shouldn't the position: absolute; on the custom arrow keep its position no matter the width of the viewport ?

    • @_Valentin
      @_Valentin 3 ปีที่แล้ว

      I have the same problem and i dont understand how to fix it :(

  • @miracleio8555
    @miracleio8555 4 ปีที่แล้ว

    Another Awesome trick, Thank you Kevin!

  • @mdyousufgazi4030
    @mdyousufgazi4030 4 ปีที่แล้ว +1

    awesome video! loved it

  • @seathwolf5610
    @seathwolf5610 4 ปีที่แล้ว

    You are the best teacher!!!! Thank you for all your videos.

  • @MikeyRussell88
    @MikeyRussell88 4 ปีที่แล้ว +6

    It's a real shame that even today css doesn't provide ways to style these elements. For security I can understand they cannot be fully customisable but the basics like colours borders arrow styles should be available to the user without needing hacks. Maybe in CSS 4 eh?

  • @arseneawounou180
    @arseneawounou180 4 ปีที่แล้ว

    Maybe you dunno but you're doing a great job and teaching a lotta people in the world! Thanks! ✨

  • @viktorbublic
    @viktorbublic 4 ปีที่แล้ว +4

    This is great. Thank you.

    • @KevinPowell
      @KevinPowell  4 ปีที่แล้ว

      You're very welcome!

  • @mattmarkus4868
    @mattmarkus4868 2 ปีที่แล้ว +1

    Great video, but how do you change the blue hover highlight color on the options? Chrome is blue, Edge is dark grey, etc. Is that possible?

  • @manosmenexis3160
    @manosmenexis3160 4 ปีที่แล้ว +3

    You could use a transformX for the arrows and then add top to the ::before and bottom to the ::after. That way it would be the same number.

  • @nonchalant8473
    @nonchalant8473 4 ปีที่แล้ว +1

    Great tutorial! Thanks

  • @elcolo77
    @elcolo77 2 ปีที่แล้ว

    Wow, nice and usefull video!!! Thanks for everyday's rising learning curve!

  • @chrisj.2611
    @chrisj.2611 4 ปีที่แล้ว +4

    Quite a nice trick. But personally i would use font awesome for example for the arrow (unless you dont want to use any outside stylesheet). But this gets rid of the before and after pseudo element.

  • @glenn4140
    @glenn4140 3 ปีที่แล้ว

    Thank you Kevin. You are so helpful!

  • @MsElsospechoso28
    @MsElsospechoso28 4 ปีที่แล้ว +1

    looking good on that zelda shirt

  • @gethermedel3620
    @gethermedel3620 4 ปีที่แล้ว

    I knew this 5 years ago. it's nice you are teaching this to others :D keep it up!

  • @waelmoh
    @waelmoh 4 ปีที่แล้ว

    pointer event, I didn't know anything about this before :D ThanQ

  • @bahaajasim3793
    @bahaajasim3793 3 ปีที่แล้ว

    Thank you Kevin

  • @nickwoodward819
    @nickwoodward819 3 ปีที่แล้ว

    The differences, afaik, between inline-block and block, is that for the former you're using inline-block instead of flex, and for the latter you're using block instead of flex
    HTH :)

  • @bhalchandragaikwad1605
    @bhalchandragaikwad1605 4 ปีที่แล้ว +1

    hi, i understood who to customize "select" things. BUT i want to change background color and selection color of "option" things. how to do this? please explain

    • @GSYSYT
      @GSYSYT 4 ปีที่แล้ว

      You don't. It's not possible to style options in a good way. You need custom markup and JS for that.

  • @giorgimindiashvili3810
    @giorgimindiashvili3810 2 ปีที่แล้ว

    i love u man i love u always when i watching your videos i always found something new bravo

  • @segsfault
    @segsfault 3 ปีที่แล้ว +1

    Kevin: pointer-events: none;
    Me: What De Fok 🤯

  • @abdiasmigaud2647
    @abdiasmigaud2647 2 ปีที่แล้ว

    Thank you very much for this video.

  • @nickwoodward819
    @nickwoodward819 3 ปีที่แล้ว +1

    Love this, but out of interest, do you know of a good source on how to make a completely custom select element?

  • @j.almadhaji
    @j.almadhaji 4 ปีที่แล้ว +2

    I enjoy watching you ❤

  • @0the0ambient0
    @0the0ambient0 4 ปีที่แล้ว

    Thanks for another great tutorial.

  • @presidiun
    @presidiun 4 ปีที่แล้ว +1

    very nice. I have a question how do you style the drop down menu so that it moves slightly up?

  • @MyDistortedWorld
    @MyDistortedWorld 4 ปีที่แล้ว

    Nice Kevin! Thanks man 👍

  • @newentu
    @newentu ปีที่แล้ว

    Excelente tutorial!

  • @tostuk2528
    @tostuk2528 3 ปีที่แล้ว

    What are the meta and link tags in the beginning of the video?

  • @abdulrahmannasser1079
    @abdulrahmannasser1079 3 ปีที่แล้ว

    My opinion is to replace these custom icons to arrow up icon from font-awesome

  • @АнтонФомичев-щ2ю
    @АнтонФомичев-щ2ю ปีที่แล้ว

    MDN
    Permitted content for :
    Zero or more or elements.
    So, could not be nested with the element

  • @q.w.e.r.t.y
    @q.w.e.r.t.y 4 ปีที่แล้ว +1

    What theme extension are you using?

    • @KevinPowell
      @KevinPowell  4 ปีที่แล้ว +1

      I'm using Atom Dark One... but I also use Bracket Pair Colorizer, so my brackets are different colors :)

  • @m2kdevelopments
    @m2kdevelopments 3 ปีที่แล้ว

    Awesome video

  • @j0ca1995
    @j0ca1995 4 ปีที่แล้ว

    Great video!

  • @benjaminhammond7925
    @benjaminhammond7925 4 ปีที่แล้ว

    Have you found a way to change the select's options background color???

  • @LukeDorny
    @LukeDorny 4 ปีที่แล้ว +1

    Could you make video with a couple of uses for clip path? Thanks, Kevin!

  • @parthosarkar5270
    @parthosarkar5270 3 ปีที่แล้ว

    How do I edit the padding of the options?

  • @abstrxtinfinity
    @abstrxtinfinity 2 ปีที่แล้ว

    Can we style the options part of the dropdown somehow? like when we hover them or select them.

  • @lucass.p9579
    @lucass.p9579 4 ปีที่แล้ว +4

    Great video. I'll do something like that in one of my project, because these difference between the browsers inputs/selects is annoying. And btw now Chrome has a super weird black outline on any type of focus.

    • @adao5308
      @adao5308 3 ปีที่แล้ว

      Try using :focus {outline:none} on the property if you're still having that problem.

  • @shaunbowen
    @shaunbowen 4 ปีที่แล้ว

    For the vertical positioning of the triangles, wouldn't it be better to use something like top: calc(50% - 0.2em) and bottom: calc(50% - 0.2em) respectively? Then you can adjust the triangle size and always have them spaced 0.4em apart in the centre?

  • @alf1712
    @alf1712 3 ปีที่แล้ว

    Is it possible to align right the items inside the select list?

  • @anamazanova
    @anamazanova 3 ปีที่แล้ว

    Hey Kevin, any advice on how to change the placeholder color for this element??

  • @vladislav.c
    @vladislav.c 3 ปีที่แล้ว

    Thanks a lot.
    And i have a question. Is there any way customize select using just css, but instead of text in option use images. Or use text and images in option.

  •  3 ปีที่แล้ว

    How can I make the same styling but with input and datalist?

  • @mattwood8659
    @mattwood8659 4 ปีที่แล้ว +1

    I was excited to see this at first. I really wanted a more consistent width for the options across the browsers but I'm a little disappointed you didn't do that. Is it possible at all to style the select options?

    • @texno5440
      @texno5440 4 ปีที่แล้ว

      not this js

  • @jaswanthsimha1418
    @jaswanthsimha1418 3 ปีที่แล้ว

    How do you select all the elements inside a div that has an id called header?

  • @phandikhang9668
    @phandikhang9668 2 ปีที่แล้ว

    Help
    How to link option with page but not use card a?

  • @neo4now
    @neo4now 4 ปีที่แล้ว

    Hi Kevin! would you consider break down and show how can you accoplishe gradian animation at the top of this page 'stripe.com' because for the love of god I just can not figure it out. (I know you have a video on some gradien animation but this once seams totaly diffrent). take care:)

  • @Sisier
    @Sisier 4 ปีที่แล้ว

    Nice video !!!
    very useful

  • @VenkateshMps
    @VenkateshMps 4 ปีที่แล้ว

    Is any way available for change the active or focus background in the select list

  • @RobertFerentz
    @RobertFerentz 3 ปีที่แล้ว

    Anyone know why chrome doesn't seem to set the background color for options given on the select element like it shows in this video? It's annoying.

  • @JamesWelbes
    @JamesWelbes 4 ปีที่แล้ว

    I prefer the per class model because when you subscribe, if you stop paying you lose access to everything. When you buy a class you get it forever

  • @fayazvar3948
    @fayazvar3948 4 ปีที่แล้ว +1

    How to change color of selected item in this.

    • @johanlarsson9805
      @johanlarsson9805 4 ปีที่แล้ว

      You can color the Option. Is that what you were asking for? Both so that the selected option looks different in the dropdown list, but also so that it looks different from others in the select box when selected.

  • @SunilKumar-jc5cb
    @SunilKumar-jc5cb 4 ปีที่แล้ว

    Can you please give me the list of HOVER CSS? Because I have tried to change the hover background color(default color blue) not able to change that.
    Can you please help me out with this?

  • @vojislavdjuric8856
    @vojislavdjuric8856 10 หลายเดือนก่อน

    Nice. Thank you.

  • @digvijaychauhan2000
    @digvijaychauhan2000 4 ปีที่แล้ว +1

    Will this affect the mobile select drop down view?

    • @KevinPowell
      @KevinPowell  4 ปีที่แล้ว +1

      The dropdown itself will look a little different in every browser. Some will still have gray backgrounds as well. The options are a bit of a wildcard.

  • @blackpurple9163
    @blackpurple9163 2 ปีที่แล้ว

    This also works for input type="number" ? By default there's no way to style those arrows too, but I don't know how to add their functionality as a increaser and decreaser

    • @patrickkaiser5505
      @patrickkaiser5505 2 ปีที่แล้ว +1

      ".stepUp()" and ".stepDown()" is probably what you need there

    • @blackpurple9163
      @blackpurple9163 2 ปีที่แล้ว

      @@patrickkaiser5505 I did find that on stackoverflow, but I didn't really understood the rest of the code properly

  • @onur-9158
    @onur-9158 2 ปีที่แล้ว

    how to change that option hover color blue ?

  • @shulehr
    @shulehr 2 ปีที่แล้ว

    very good tutorial

  • @mohdshanu
    @mohdshanu 4 ปีที่แล้ว

    Is it possible to change option items design?

  • @KlaudiusL
    @KlaudiusL 4 ปีที่แล้ว

    @15:28 ... my daily css programing

  • @vojka2973
    @vojka2973 4 ปีที่แล้ว

    everything is fine but when I select an option in firefox, the select box shrinks however it wants, in chrome is fine... why is that ? do you know how to fix this ? ty

  • @karlo-o2z
    @karlo-o2z 3 ปีที่แล้ว

    13:20 how do you write on three rows in same time

    • @KevinPowell
      @KevinPowell  3 ปีที่แล้ว +1

      Depends on the editor, but in VSCode (on windows) you hold down alt while clicking to place the cursor in multiple places

    • @karlo-o2z
      @karlo-o2z 3 ปีที่แล้ว

      @@KevinPowell Thanks !

  • @maneeshrockx667
    @maneeshrockx667 4 ปีที่แล้ว

    Thankyou , I learned something interesting 😍.. can I know what theme are you using in vs code?.

  • @muralidharan4216
    @muralidharan4216 3 ปีที่แล้ว

    How to change the options hover blue color ? Thanks In Advance...!!!

  • @pawejurgielewicz7892
    @pawejurgielewicz7892 4 ปีที่แล้ว

    Geat video as always! I just have a little question: how can you use Firefox and Chrome simultaneously via Live Server in VScode?

    • @migueldomingos4570
      @migueldomingos4570 4 ปีที่แล้ว +1

      It works automatically in that way since it is running on a port on your localhost. You just have to go to localhost:5500 on both firefox and google

  • @azhardanii
    @azhardanii 2 ปีที่แล้ว

    amaziinggg sir, but any method to change hover color on selection option items? its soo difficult for mee, pleaseee helpp 🙏😭

  • @smsibasish
    @smsibasish 4 ปีที่แล้ว

    How to solve the fat scroll bar issue in windows?

  • @burakesen4166
    @burakesen4166 4 ปีที่แล้ว

    How would you give the items a padding to make it look nicer on chrome ?

    • @KevinPowell
      @KevinPowell  4 ปีที่แล้ว

      The dropdown list thing itself? Not much you can do there sadly.

  • @peetboy
    @peetboy 4 ปีที่แล้ว

    Worth mentioning that *appearance* css property is experimental, not fully supported by all browsers.

  • @ThillaiArasuNarayananAR
    @ThillaiArasuNarayananAR 4 ปีที่แล้ว

    Whats the screen recorder you are using ?

  • @hcsftw
    @hcsftw 4 ปีที่แล้ว

    Hi Kevin, could you put this Demo into a Codepen? I am a bit too lazy to retype it, but I would love to experiment with it!

  • @miroslavresanovic5852
    @miroslavresanovic5852 4 ปีที่แล้ว

    How to change blue color in dropdown hover?