Step up your CSS game using these selectors and combinators

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

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

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

    This is one of the most underrated channel on whole TH-cam for web dev.
    One of the best explanation of advance selector on whole TH-cam..

  • @jenna___6443
    @jenna___6443 6 ปีที่แล้ว +93

    You're one of my constant go-tos in the TH-cam Realm, thanks so much for your high quality content!

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

      So glad to hear that Jane! Really glad that you're enjoying my videos!

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

      @@KevinPowell Just as a side note... the emoticon gallery has been really extensivelt developed, and many icons you can find in this gallery, which is built in, which means you do not have to make another separate request for an icon. You need to set UTF-8, but everyone should use that anyways. And emoticons can be used as single colors too, so you can color it. You should use the entities for it, just to be sure.

  • @sjn_
    @sjn_ 5 ปีที่แล้ว +8

    The attribute selector was what I had been looking around for months. You sir just answered all of my questions related to that here. Thank you very much, mate!

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

    I loved your easy explanation of + and ~. I was using + everywhere because I didn't really understand the other. It really cleared things up for me!

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

      + is the selector for the next SINGLE ELEMENT (of some kind) after some element while the other, ~, selects the next MULTIPLE ELEMENTS (of some kind) after some element. You can think of + as a css way for js Element.nextElementSibling with additional check to Element.matches()

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

    I really appreciate you explaining the reset. So many people just tells you to include a reset with minimal explanation.
    Enjoy your tutorials. Thanks!

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

      No problem at all! Thanks for the feedback, it's good to know when these things are appreciated 👍

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

    Thank you for providing us with so many helpful explanations. I've been using advanced selectors for several months, but it's often been a bit of a trial & error guessing game to figure out which one I need. This video gave me a much better understanding of the children and sibling selectors. And I had barely looked at the attribute selector before, but now that makes a lot more sense too.

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

    Kevin, Every time I watch a video for you I learn something new, no idea where you get the stuff from, but here I am learning something new today, Thanks a million and God Bless You.

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

      Hopefully I can keep finding these things 😂

  • @preethi-dev
    @preethi-dev 2 ปีที่แล้ว +1

    every day really your videos brush up my CSS skills. while I see your thumbnails of videos, feel like finally will go to understand the crucial concepts. feeling blessed

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

    I not only liked it, instead I loved it and I love all your efforts that are helping us incredibly and amazingly... Love you Man

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

      So happy that you enjoyed it that much Ankit!

  • @rebelmachine88
    @rebelmachine88 5 ปีที่แล้ว +7

    I basically had no idea these existed, so thank you!

  • @konraddariuszwoloszyn9206
    @konraddariuszwoloszyn9206 6 ปีที่แล้ว +8

    If I remember correctly, we call the "straight line down thing" a pipe :). Great video!

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

      That's it! Thanks Konrad!

  • @TransverseAudio
    @TransverseAudio 6 ปีที่แล้ว +5

    Great video, I really like the level of depth you put into the explanations and for even setting up the demo. Well done, keep up the good work!

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

    thanks so much! another great use of selectors is in javascript with document.querySelector, I use it for automating stuff on websites all the time, and with these new css tricks i'll be UNSTOPPABLE :))

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

    Thank you Kevin, you are the best css teacher I ever had.

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

    Thanks for the video, Kevin. Like all of your videos, I found it very helpful. Please keep them coming.

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

    Looking forward to using attribute selectors. Good stuff.

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

    Man those attribute selectors! How have I not heard of these before!?

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

    Very helpful tutorial. Short and to the point. Thanks Kevin!

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

    The attribute selectors felt familiar . . . regular expressions! Had no idea we could use regexp in css. Super helpful information.

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

    Very informative and technical info. Thanks a lot. Examples really show something different like blue vs green, like totally different

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

    Excellent content; I like the level of detail while remaining basic and easy to comprehend with an example. Thank you for providing such high-quality information. Bravo!

  • @LuisReyes-zs4uk
    @LuisReyes-zs4uk 3 ปีที่แล้ว

    my favorite TH-cam channel.

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

    You made that look too easy! Thanks a million, Kevin. Practically, what I'm gonna be watching next is, you versus Kevin on a css battle. 😂♥️

  • @benzflynn
    @benzflynn 5 ปีที่แล้ว +25

    One almost essential selector these days is the *:not* selector.
    It's the best way to do things like:
    1) Exclude the logo (home page link) from the usual rule of marking the current webpage (here classed as ".point")
    e.g. .point:not(.mylogo)::after {
    width: 100%;
    height: 2px;
    }
    2) Exclude the current page from the usual hover marker
    e.g. .navlink:not(.point):hover::after {
    width: 100%;
    height: 2px;
    }

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

      True!! I use this selector almost every time!!

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

      The :not() selector is said to be expensive for performance but it is used a lot in the implementation of the Edge (the new version) DevTools UI an probably in Chrome DevTools also... So... If it's good enough for them it for me too.

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

      @@Victor_Marius It's not a *visible* issue on my Huawei Y6 smartphone. But surely the preprocessor could handle this type of selection assignment ?

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

    at 12:19 >> *"|"* is called >> verti-bar, vbar, stick, vertical line, vertical slash,bar, pike, or pipe, and several variants on these names. from en.wikipedia.org/wiki/Vertical_bar My teacher Called it Pipe Symbol in class.

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

    Awesome demo, Kevin Powell. Thanks! Just one thing I’ll point out, and I’ve used it for this before: attribute selectors are a good workaround to override !important. As I’m sure you’re well aware, Bootstrap templates/overrides can be a bit (ahem) clunky, so that’s been a failsafe for me in some situations.

  • @facundocorradini
    @facundocorradini 6 ปีที่แล้ว

    Nice tutorial as always. A nice use case for attribute selectors is combining them with data- attributes

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

      Good point, I should have mentioned that in the video 😕

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

    BAH DAH BAH BAH BAHHH....I'M LOVING IT!!! Thanks KP!

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

    Tremendous content kevin. millions of kudos for you.

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

    Kevin, you are awesome. I always learn thanks to your videos

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

      Thanks Oscar, glad you like my content :D

  •  4 ปีที่แล้ว

    Thanks for high quality and easy to understand contents.

  • @josephboykin3443
    @josephboykin3443 6 ปีที่แล้ว

    The "straight line" is a pipe. This video is excellent bty.

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

      I always forget that for some reason! And glad you enjoyed the video

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

    Thanks Kevin,fr taking out time to make videos

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

      No problem at all Mari, glad you liked it :)

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

    I'am loving it
    this is just so easy and clear to understand
    thank you sooooo much...........

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

    I know I'm kinda late, but I just want you to know I like this video.

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

    Nice explanation.....Best video of selectors
    Learned so much from you sir..

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

    This isx a great video - previously I was using JavaScript to add a little icon after external links - but now I've changed that to this CSS:
    a[rel*="external"]::after {
    content: url('/images/external-link.png');
    padding-left: 5px;
    }
    Thanks!

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

      Thanks so much for the super kind words, and really glad that you're enjoying my content!

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

    It's detailed information about advanced selector, Thank you so much for it.

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

    Many thanks for all of the tutorials. You are the best.

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

    Great and informative video. I didn't know you could put an url in the content, that was something new for me. I don't understand why they don't clearify that the vertical bar selector hasn't anything to do with what the word starts with rather that it needs to be one exact word, unless you have a hyphen seperating it (but this is just an exeption).

  • @darrellparkhouse175
    @darrellparkhouse175 6 ปีที่แล้ว +122

    the character that is up and down is called the pipe symbol lol

    • @KevinPowell
      @KevinPowell  6 ปีที่แล้ว +15

      Thanks Darrell, I should've know that :\

    • @JayCarey45
      @JayCarey45 6 ปีที่แล้ว +3

      Came here for this.... four months too late.

    • @ELP1125
      @ELP1125 6 ปีที่แล้ว

      Or a separator

    • @JawsoneJason
      @JawsoneJason 6 ปีที่แล้ว +17

      Its official typography name is "vertical bar": en.m.wikipedia.org/wiki/Vertical_bar

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

      Or the OR symbol, if you're a Java(Script) coder LOL . . .

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

    Good one. Very clean explanation. I enjoyed it.

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

    omg this is GREAT ! i learnt a lot ! thank you so much Kevin :)

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

    The universal selector is also used to set the box sizing calculation:
    * {
    box-sizing: border-box;
    }

  • @AmitKumar-sl3cr
    @AmitKumar-sl3cr 5 ปีที่แล้ว +1

    I just wanna say thank you to upload these awesome videos.it helped me a lot :)

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

    Great explanation

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

    12:19 That's usually called a vbar, for vertical bar, or just bar. It has some other names when it's used for logic or math though.

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

    I love the technicals !!!!! Very clean coding is soo much BETTER ! Thank You. Peace :)

  • @DINESHKUMAR-xn6ij
    @DINESHKUMAR-xn6ij 6 ปีที่แล้ว

    Thanks a lot Kevin, Very nice explanation

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

      Thanks Diniesh! Glad you liked it!

  • @seemsas
    @seemsas 6 ปีที่แล้ว

    Thanks for the video. It filled some gaps and I can use some of the advanced selectors right now :)

  • @jatindersingh-lq2fd
    @jatindersingh-lq2fd 6 ปีที่แล้ว

    Very helpful, thanks a lot Kevin.

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

    u r my boss, clear and cool videos, plz more :D

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

    Awesome explanation. I liked it :)

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

    Loved the videos!

  • @gknt694
    @gknt694 6 ปีที่แล้ว

    Using a[class*="another"] { color: red; } ( your code was a[class|="another"] { color: purple; } ) instantly changes the color even though if "another-link" is typed "anotherlink" buddy ! Keep that in mind :) I'm using div[class*="col-"] for Bootstrap.

    • @gknt694
      @gknt694 6 ปีที่แล้ว

      Okay you mentioned it. My fault :D

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

      lol, no problem :)

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

    King, the straight line down thing is called 'pipe' .

  • @anasrida3454
    @anasrida3454 6 ปีที่แล้ว

    Found out about your channel today. Incredible content. Instant subscribe!!

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

      Glad you liked it and thanks so much for the sub!

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

    12:19, it is called "Pipe" symbol.

  • @albertgalvez2556
    @albertgalvez2556 6 ปีที่แล้ว

    These are going to be very helpful, thank you.

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

      No problem Albert!

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

    Kevin, I love your content. I find it hard to see where you are "swishing lol" around with your mouse when you are pointing out a feature. Could you be a little more descriptive of where you are pointing with your teeny tiny pointer? Good video!

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

      Protip: Make the mousepointer larger and set it to the 'negative' theme (it'll turn black on a white background and white on a black background!)

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

    Hi Kevin. What if you opinion of doing margin-bottom: 0, instead of margin-top: 0 in the * selector ?

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

    love it. Thanks alot for your video

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

    Super useful, thanks

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

    Hi Kevin! Is there an actual difference between * + * and *:not(:first-child) (when it is actually first child) or is it just more idiomatic/less typing? thanks

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

      As for the final result these are the same I believe. I think *+* is older and thus has better support. Another thing to consider is that :not() is advised to lesser use as it has bad performance and increases specificity (I don't remember where I read that, maybe on developer.mozilla.org)
      Good lecture on this topic is at
      developer.mozilla.org/en-US/docs/Web/CSS/:not
      and
      developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes

  • @Safwan.Hossain
    @Safwan.Hossain 4 ปีที่แล้ว

    Really well made video.

  • @indieNik
    @indieNik 6 ปีที่แล้ว

    Thank you Kevin. Your videos are Awesome as always :)

  • @RH-nk7eo
    @RH-nk7eo 4 ปีที่แล้ว

    How can I only select elements which DON'T contain an tag? Not sure how I can use the :not selector for this purpose.

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

      Not possible with only CSS. There is no parent selector, otherwise we could probably figure something out.
      Might be a way to do it with JS.

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

    I really enjoyed this

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

    Great video. Thank you

  • @nonchalant8473
    @nonchalant8473 6 ปีที่แล้ว

    Very helpful tutorial. Thanks

  • @vhwc4191
    @vhwc4191 6 ปีที่แล้ว

    Thanks for your clear explanation on the selectors with great examples.

  • @udarakasun
    @udarakasun 6 ปีที่แล้ว

    You are Great kevin. Thanks lot.

  • @HekmatKhyber
    @HekmatKhyber 5 ปีที่แล้ว

    What an awesome lesson!

  • @Salmancreationbd
    @Salmancreationbd 5 ปีที่แล้ว

    Great Video . Thanks a lot , very helpful

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

    Awesome, content. Thanks.

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

    Kevin, why wasn't the selection like
    .general-sibling + .box, but rather it was .general-siblings .box + .box?
    i am confused

  • @tomasslezak3628
    @tomasslezak3628 6 ปีที่แล้ว

    Great tips, thanks.

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

      No problem, glad you liked it.

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

    to call "+" an "adjacent sibling" operator is a misnomer. It's really a _succeeding_ sibling operator

  • @abhishekverma614
    @abhishekverma614 5 ปีที่แล้ว

    Really helpful thanks a lot !

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

    11:25 It would have been more handy if Relational operators (like ==) are used.

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

    So good tutorial

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

    I have doubt will it work if the links are nested in divs the + adjacent attribute

  • @mikej7476
    @mikej7476 5 ปีที่แล้ว

    Good stuff man, thanks.

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

      Glad you liked it :D

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

    The straight line down is called a 'pipe'

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

    Great tutorial!!! I learned a lot from your tutorial...tysm :):)
    I want to select the parent list element by selecting the child anchor tag in it with CSS only not JS, can you help me out?

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

    Thank you sir, very informative video to learn CSS Selector. These days I am hearing a lot about SelectorsHub CSS Selector tool, hows that tool sir?

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

    I was just thinking.. is it possible to cause a Circular-Reference/Recursion/Endless-Loop with CSS?! like with this attribute selector like "a[xy..]" ?

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

    Great content!

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

    2:45 Death to pointless margin-top! Boy I enjoyed hearing that.

    • @pixelheart2467
      @pixelheart2467 5 ปีที่แล้ว

      are you web a web developer?

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

      @@pixelheart2467 ? yes, if I understand your question, and if it was directed at me

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

    @Kevin Powell At the university i am attending we are learning about something called universal web-design is this something you follow and keep in mind while designing web-sites?

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

    Well Done Kevin. I am a frequent visitor.

  • @nmoschen
    @nmoschen 6 ปีที่แล้ว

    Awesome video!

  • @kamarchand
    @kamarchand 6 ปีที่แล้ว

    Great Video. thanks

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

    Good video
    just want to know how to go up (select) for parent, grand parent or grand grand parent of a child object?

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

      No selector that goes that way, sadly :(
      :focus-within might be the closest, where if you say, .form:focus-within, if anything inside the form has focus, it'll style the form differently (as an example). But it relies on focusable elements obviously.

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

    Best teacher!!!

  • @rslahmed383
    @rslahmed383 5 ปีที่แล้ว

    thanks man, make a video with pseudo element selector like nth-child

  • @KimLetkeman
    @KimLetkeman 5 ปีที่แล้ว

    Great video. Those attribute selectors appear to loosely take their meaning from regular expression processing.

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

      I think they really are.
      ^= matches attributes that starts with some string bounded by anything;
      $= matches attributes that ends with some string bounded by anything;
      *= matches attributes that contains some string bounded by anything;
      |= matches attributes that starts with some word bounded by space;
      ~= matches attributes that contains some word bounded by spaces or hyphens.

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

    Great video 👏🏼👏🏼👏🏼👏🏼👏🏼

  • @tolumideshopein
    @tolumideshopein 6 ปีที่แล้ว

    great video...thank you!

  • @sawknitsrestha3698
    @sawknitsrestha3698 5 ปีที่แล้ว

    Thank you!