How To Make Tooltips With Only CSS

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ก.พ. 2025

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

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

    Just bought the course - haven't been hyped for something like this in a long time! Great videos, keep it up, Kyle!

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

      Thank you so much! It really means a lot.

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

      Kyle is really good at teaching/explain complicated thing, though the tooltip is just a small component, it takes a lot of code to accomplish. Without good teacher's leading most people go for library or framework !!!

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

    Oh cool, was just learning about CSS variables and was wondering why you'd use them, but the end of the video is a great example of why. Thanks as always!

  • @mirkoat22
    @mirkoat22 2 หลายเดือนก่อน

    Thank you so much for this, this small feature made my web apps look so much better. Thanks Kyle!!

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

    Hey Kyle, I really enjoyed this one and during this challenge my understanding of some concepts got more clear. Thank you man!!

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

    Good job as always. This is exactly what I did a week ago. One tip: You can also select elements by attribute in css, so you can slap the attribute on pretty much every non self closing element and it just works.

  • @董宜璇
    @董宜璇 4 ปีที่แล้ว +4

    🙏🏽thank you! This is such a useful css skill which I’ve never used before!

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

    Thank you so much sir. Needed it. One suggestion. You can enable autosave from File>Autosave to see the live preview faster and avoid saving.

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

      I actually like having control over when I save so I can emphasize specific groups of changes.

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

      No problem that's fine. Thnks a lot for this one. BTW, do you have a discord server? I want to join as much as I can

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

      I do. It is linked in the description.

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

      @@WebDevSimplified Thanks a lot

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

    Well, yes. But add detection of when there is no room to show the tool tip north of the trigger, and display it south. While it can't be done in CSS (because there is no selector for "not all of this rectangle is visible", the challenge is to do it with a minimal amount of JavaScript code.

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

    Very informative and what's more: straight to the point, which iscrare on youtube nowadays.
    Probably no coincidence the ads interrupting this video are from Whiskas

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

    I love yor channel, I'm a developer from Argentina, your videos are so usefull to me, thanks!

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

    you are really awesome mannn, you helped me a lot with my css and your voiiiiccceee is soooo nice, wish you the best

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

    Excellent. This is what you can do with deep knowledge of the inner workings of CSS. Yes, it's a lot of code, but each bit is doing something, and understanding each bit gives you another tool you can use somewhere else.
    Took me a bit to figure out the border triangle. I was thinking rotation, but if you don't have to, less is better.

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

    Omg! I have been waiting for you videos since quarentine.

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

      Hopefully I can make being stuck at home a bit better.

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

    Thanks!

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

    Thanks very much, what if you want to set the direction of the tooltip, cos sometime it goes out of the screen considering the fact that the div is at the top of the screen

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

    Oh my god, this is incredible! Thank you SO much! No more suffering with trying to code tooltips in JS!

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

    Kyle, I appreciate you man. Thanks for this lesson. I did check your blog post on the CSS triangle. It was really informative and helpful. Big ups to you bro. God bless you. You are doing great. ✌️❤️

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

    Would take me weeks to figure out without this tutorial.

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

    Didn't know the concept of triangles before. Thank you so much.
    ✨✨

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

    I learnt a lot of other things, instead of just tooltips.

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

    A stealth tutorial on the usefulness of CSS variables

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

    great vids appreciated! would be cool to see a vid of you explaining your background, like when you got into code how long you've been doing it why u did it etc etc. just nice to have the inspiration sometimes to see peoples stories

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

    14:23 there’s still visible 1px gap between them 😂 maybe just move that arrow up few pix, it’s not noticeable on green color

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

    omg... thank u so much buddy... I subscribed your channel... keep it up... sending you a lots of love...

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

    Awesome tutorial as always dude... It's a buttload of code for a simple tool tip.. but at the end of the day cant argue it's well worth it!.. Ty

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

    This is some intense CSS! WOW!

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

    thanks ..... i was needing this soo much...

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

    This was a great tip. Thanks. :)

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

    Hi, Kyle, thanks for all the good video's.
    I have been trying to do a CSS only Tooltip for a while now. And with each solution on the web, including yours, is that when the tooltip get's to big and go's off screen i see some dark bars at the bottom of the screen.
    I love to have the tooltip switch position based on the location where it wants to been shown. Like when the tooltip starts to far to the left (outside the screen) it will always move to the right same for when the width is to large so the tooltip is going outside the screen.
    For the vertical positioning, when there is no space on top of the element it should show itself below the element.
    I know there are some JS scripts doing that but can it somehow been done in modern CSS ?

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

      sorry I don't have answer according to your need
      but you can set overflow: hidden for the body tag at the start of the CSS
      these will remove the bottom scroll bar

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

    Hey, that's awesome. Thanks for sharing!

  • @RubenMartinez-qp2gg
    @RubenMartinez-qp2gg 2 ปีที่แล้ว

    you are awsome and a good teacher, thanks

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

    You are just Awesome brother :)

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

    You are just awesome brother 💕💕💕

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

    i just figured using data attributes in css has so many use cases....... thank you very much.

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

    Saved my day😍you're awesome😍😍Thank you ❤️

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

    This is wonderful, thank you so much!

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

    Wow I actually learned something new

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

    Great video as always, love the way you teach, its awesome. There is one thing to catch and its since the position is absolute the tooltip is shown within its parent and goes behind other elements which is not desirable and as long as I change the position to Fixed it doesn't work. Its appreciated if comment it out

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

    Does anyone know to style text like addding or in data-tooltip? I've read something related to BS.

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

    Incredible tips, thanks a lot

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

    Thank you! Keep up the good work 👍🏻

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

    Just subbed to your CSS course 👍

  • @Helen-mu2yv
    @Helen-mu2yv 3 ปีที่แล้ว

    Thank you so much!

  • @HossamKhalaf-sr1oo
    @HossamKhalaf-sr1oo 4 ปีที่แล้ว

    thanks for the great work!! wish that i won the course.. needed badly

  • @marcosferreira6638
    @marcosferreira6638 2 หลายเดือนก่อน

    thank you 😀

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

    Thanks kyle for a once again great tutorial

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

    Very helpful video, thank you so much!

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

    Ty bro a lot you save my time :)

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

    Great tutorial. I was working on a tooltip today, but messed up. I'll try again tomorrow with the help of this tutorial.
    Question relating to Visual Studio Code: how do you get the background to not show your desktop? I set mine to show it, but I don't want it now lol. It's hard to see everything.

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

    thank you so much bro

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

    Why are we selecting both ::before and ::after?

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

    video is the best it is useful thank you

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

    This is the best tutorial I've seen in months! Thanks! Will be checking out your course, soon. How can I replicate this for 6 items, though without having to copy all of that over 6 times and give it a new class name?

  • @rudi-batubara
    @rudi-batubara ปีที่แล้ว

    Tooltip flow clue: 1. Create a tooltip wrapper by fragment, so we do add addition element on it, 2. initialize a child component thought cloneElement and attach a ref on it, 3. add a tooltip element with a forward ref and add it to wrapper by a portal, attatch a mouse and leave event handler to any child element thougt clone element same as we did before for ref on child component, 4. Get bounds of child component X and Y coordinate, passing this coordinate to tooltips component thought style attribute. 5. End...

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

    Great explanation! I was wondering if anyone knows how to do the exact same thing, but with a border or a shadow around the entire tooltip? Other tutorials suggest adding a second triangle for the border using the ::after pseudo-element, but in this tutorial we're already using both the ::before and ::after

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

    what does the
    *, *::before, *::after {
    box-sizing: border-box;
    }
    rule do?

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

    For tooltip dynamic positioning, we need javascript right?

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

    Great vid, can i use a tooltip also for tables?

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

    I'm new in WebDev and still learning it, so I wonder what is the point of using the tooltip? What's the difference if we do it like e.g. content: attr(data-tooltip), or we just simply do content:'Thinking cat''; (What is the point in using data- attributes if we aren't making carousel for example). Thanks in advance!

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

    Awesome! But, do you know how I can add the property "backdrop-filter" on the tooltip, is this possible ? I would like the blur effect on the background of the text...

  • @kenthomas1109
    @kenthomas1109 7 หลายเดือนก่อน

    Very cool!

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

    8:20 this CSS variable support all browsers? I'm confused how to make this variable? it should be from a " :root " right?

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

    If the tooltip has a lengthy string, then the box scales vertically instead of horizontally. How to fix this?

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

    I just add a "title" attribute to the HTML and call it a day. 😂

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

    Hi Kyle, how to change the tooltip position dynamically (current it is top if i want to show at bottom , left or right)

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

    Hi, can you please make some video on the tooltip card which will work exactly like the google map tooltip card on hovering on the location.
    Thanks,

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

    How can you delay the hover though? Rollups shouldn’t display right away.

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

    Does work for input text as well?

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

    Great video, just what I was looking for. One question though. Can the "data-tooltip" attribute only accept text (in this case "Thinking Cat"), or we can also insert HTML tags such as into it?

    • @511-neelbutani9
      @511-neelbutani9 3 ปีที่แล้ว

      At 3.43 can you tell why he applied before and after both at a time!

  • @MightyHuff
    @MightyHuff 3 หลายเดือนก่อน

    How do you get the arrow to come out of the other sides ?

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

    Hi Kyle. I'm stuck in my tooltip tutorial that I have just followed in your video here. My image does not show up :(. I don't know what happened.

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

    We already sent people to the moon but in 2020 we still need a 15-minute tutorial and a whole bunch of code to make a simple tooltip.

  • @soumelee5661
    @soumelee5661 11 หลายเดือนก่อน

    amazing video

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

    You're a god among men, thanks!

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

    Its crazy how much work the frontend devs have to do to for such a small component

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

    Amazing~

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

    Hi Kiel.Very good tutorial.But I am encountering one problem here.when I reduce the size of the screen the tooltip moves away from it's central position of the object .I mean it is before when screen enters tablet or mobile pixels.Can you give tip how to figure out this issue.Thanks.

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

    do you know why the hover grow animation is bumpy and the uncover shrink animation is smooth? im using safari

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

    how to set the position of tooltip right left top or bottom?

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

    Great video

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

    Cool lesson, but how to insert HTML code inside the data-tooltip attribute to style a multiline tooltip?

  • @ZeeshanAhmad-lq5nc
    @ZeeshanAhmad-lq5nc 4 ปีที่แล้ว

    in ::after and ::before % which refers to, is itself or just .tooltip?

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

    Does this apply for long text as well?

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

    I love your videos

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

    Hi good video 👍 but
    What is the difference between Tooltip and Hotspot??? 🤔
    I would appreciate your answer

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

    thnaks bro

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

    Thank you for this. Can you do a video about plotting data using HTML CSS?

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

    7:27 I set max width to 100% but my text still overflowing.. can someone tell me why? :(

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

    May I ask how you get the circle the cat is in?

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

      border-radius should solve that.

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

    DIOS TE BENDIGA, Gracias por compartir tus conocimientos

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

    It doesn't work when you have to deal with overflow: hidden in parent element. The tooltip gets clipped if the parent has overflow: hidden. If there is a workaround for it. Pls let me know

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

    It happens to me that the tooltip shows up when the tooltip itself is hovered. Any clue on how to solve that? Much appreciated!:) Greate tut btw

  • @ZeeshanAhmad-lq5nc
    @ZeeshanAhmad-lq5nc 4 ปีที่แล้ว

    can we reference other html element in other element with attribute and use it with js or css, if can how to do it, because i have seen in many websites to do that.

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

    I want the same tooltip but on right direction how can I do that?

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

    thanks you

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

    When I have elements underneath the tooltip that have a z-index greater than 0, the tooltip sits underneath the element. Changing the z-index of the tooltip itself doesn't fix this. Any idea why this is happening?

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

    How would you fix when the hover area is bigger than the element. In this case, the cat photo?

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

    Maybe silly question, but how can I put a a href only on the textbubble?

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

    Which extension do you use for the live preview? I used to code with "Live Server" but it never works...

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

      When you look at the bottom bar of VSC you can see that he is using live server. Does the extension throw an error for you or does it just refuse to reload?

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

      @@ScileSc It's been a while so I honestly don't remember what was the issue. I think it just stopped reloading the page with no reason.

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

    can I use the tooltip on the button to display the message