Step up your CSS game using these selectors and combinators

Sdílet
Vložit
  • čas přidán 27. 08. 2024

Komentáře • 233

  • @amina___6443
    @amina___6443 Před 6 lety +92

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

    • @KevinPowell
      @KevinPowell  Před 6 lety +4

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

    • @AntiAtheismIsUnstoppable
      @AntiAtheismIsUnstoppable Před 2 lety

      @@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.

  • @MavericKKumar
    @MavericKKumar Před 3 lety +3

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

  • @sjn_
    @sjn_ Před 5 lety +7

    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!

  • @ankitagrawal4529
    @ankitagrawal4529 Před 5 lety +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  Před 5 lety

      So happy that you enjoyed it that much Ankit!

  • @ashleyhoward14
    @ashleyhoward14 Před 3 lety +6

    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 Před 3 lety +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 Před 6 lety +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  Před 6 lety +1

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

  • @ga7853
    @ga7853 Před 5 lety +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  Před 5 lety

      Hopefully I can keep finding these things 😂

  • @preethi-dev
    @preethi-dev Před 2 lety +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

  • @francopdx
    @francopdx Před 2 lety +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.

  • @TransverseAudio
    @TransverseAudio Před 5 lety +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!

  • @scottwagoner2402
    @scottwagoner2402 Před 6 lety +4

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

  • @LuisReyes-zs4uk
    @LuisReyes-zs4uk Před 3 lety

    my favorite CZcams channel.

  • @konraddariuszwoloszyn9206

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

  • @rebelmachine88
    @rebelmachine88 Před 5 lety +7

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

  • @benzflynn
    @benzflynn Před 4 lety +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 Před 4 lety

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

    • @Victor_Marius
      @Victor_Marius Před 3 lety +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 Před 3 lety

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

  • @SYPCWAK
    @SYPCWAK Před 4 lety +2

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

  • @mascatrails661
    @mascatrails661 Před 3 lety

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

  • @amirulidzham3686
    @amirulidzham3686 Před 4 lety +2

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

  • @alinawaz4034
    @alinawaz4034 Před 5 lety +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.

  • @ladidaddi2798
    @ladidaddi2798 Před rokem

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

  • @ulissemini5492
    @ulissemini5492 Před 4 lety +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 :))

  • @darrencorona3695
    @darrencorona3695 Před 2 lety

    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!

  • @marcosfitzsimons
    @marcosfitzsimons Před 2 lety

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

  • @joeldcanfield_spinhead
    @joeldcanfield_spinhead Před 5 lety +2

    Looking forward to using attribute selectors. Good stuff.

  • @GoskitarDTV
    @GoskitarDTV Před 6 lety +4

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

    • @KevinPowell
      @KevinPowell  Před 6 lety

      Thanks Oscar, glad you like my content :D

  • @akhil5020
    @akhil5020 Před 6 lety +4

    Thanks Kevin,fr taking out time to make videos

    • @KevinPowell
      @KevinPowell  Před 6 lety +2

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

  • @darkpain4208
    @darkpain4208 Před 2 lety +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. 😂♥️

  • @facundocorradini
    @facundocorradini Před 6 lety

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

    • @KevinPowell
      @KevinPowell  Před 6 lety

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

  • @eddymison3527
    @eddymison3527 Před 3 lety +1

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

  • @darrellparkhouse175
    @darrellparkhouse175 Před 6 lety +122

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

    • @KevinPowell
      @KevinPowell  Před 6 lety +15

      Thanks Darrell, I should've know that :\

    • @JayCarey45
      @JayCarey45 Před 6 lety +3

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

    • @ELP1125
      @ELP1125 Před 6 lety

      Or a separator

    • @JawsoneJason
      @JawsoneJason Před 5 lety +17

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

    • @benzflynn
      @benzflynn Před 4 lety +5

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

  • @rgraph
    @rgraph Před rokem +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  Před rokem

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

  • @vishalkank6853
    @vishalkank6853 Před 2 lety

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

  • @joeldcanfield_spinhead

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

  •  Před 4 lety

    Thanks for high quality and easy to understand contents.

  • @nilamrakholiya5650
    @nilamrakholiya5650 Před 2 lety

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

  • @isaac6560
    @isaac6560 Před 3 lety

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

  • @fzben44
    @fzben44 Před 6 lety +6

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

  • @victormondol6512
    @victormondol6512 Před 2 lety

    Tremendous content kevin. millions of kudos for you.

  • @josephboykin3443
    @josephboykin3443 Před 6 lety

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

    • @KevinPowell
      @KevinPowell  Před 6 lety

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

  • @harshdevmurari007
    @harshdevmurari007 Před 4 lety

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

  • @mehdisalimi5820
    @mehdisalimi5820 Před 3 lety

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

  • @XMattingly
    @XMattingly Před 2 lety

    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.

  • @AmitKumar-sl3cr
    @AmitKumar-sl3cr Před 5 lety +1

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

  • @gknt694
    @gknt694 Před 6 lety

    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.

  • @francislambert5189
    @francislambert5189 Před 5 lety +1

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

  • @sirinongorur5676
    @sirinongorur5676 Před 3 lety

    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).

  • @XVSlyke
    @XVSlyke Před 5 lety +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.

  • @zainslamdien8138
    @zainslamdien8138 Před rokem

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

  • @timbittins
    @timbittins Před 3 lety

    Good one. Very clean explanation. I enjoyed it.

  • @ChrisAthanas
    @ChrisAthanas Před 3 lety

    Great explanation

  • @StuffIMade
    @StuffIMade Před 4 lety

    Loved the videos!

  • @sarfarazsuri
    @sarfarazsuri Před 2 lety

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

  • @RoshanPradhan2
    @RoshanPradhan2 Před 3 lety +2

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

  • @seemsas
    @seemsas Před 6 lety

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

  • @Safwan.Hossain
    @Safwan.Hossain Před 4 lety

    Really well made video.

  • @vasyaqwe2087
    @vasyaqwe2087 Před 2 lety

    Super useful, thanks

  • @mr_funtor
    @mr_funtor Před 3 lety

    I really enjoyed this

  • @hieronimkutwa1065
    @hieronimkutwa1065 Před 2 lety

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

  • @kalijunaidtest2862
    @kalijunaidtest2862 Před 5 lety

    am i the only one who come to youtube from udemy to learn and think these guys are actually better?

    • @KevinPowell
      @KevinPowell  Před 5 lety +1

      Haha, thanks :). Udemy can be very hit and miss. I'm all for paid courses that deliver, but too many there are lower quality sadly.

  • @DINESHKUMAR-xn6ij
    @DINESHKUMAR-xn6ij Před 6 lety

    Thanks a lot Kevin, Very nice explanation

  • @indieNik
    @indieNik Před 6 lety

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

  • @jatindersingh-lq2fd
    @jatindersingh-lq2fd Před 6 lety

    Very helpful, thanks a lot Kevin.

  • @anasrida3454
    @anasrida3454 Před 6 lety

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

    • @KevinPowell
      @KevinPowell  Před 6 lety

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

  • @black_platypus
    @black_platypus Před 3 lety +1

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

  • @albertgalvez2556
    @albertgalvez2556 Před 6 lety

    These are going to be very helpful, thank you.

  • @Comment112358
    @Comment112358 Před 3 lety

    love it. Thanks alot for your video

  • @ashkanahmadi
    @ashkanahmadi Před 4 lety

    Great video. Thank you

  • @vhwc4191
    @vhwc4191 Před 6 lety

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

  • @techiesrikanth2447
    @techiesrikanth2447 Před 3 lety

    Awesome, content. Thanks.

  • @HekmatKhyber
    @HekmatKhyber Před 5 lety

    What an awesome lesson!

  • @sonamuhialdeen7866
    @sonamuhialdeen7866 Před 3 lety

    So good tutorial

  • @mohan9285
    @mohan9285 Před 4 lety

    Awesome explanation. I liked it :)

  • @OrincyWhyteDesigns
    @OrincyWhyteDesigns Před 2 lety

    Best teacher!!!

  • @danielmadison4451
    @danielmadison4451 Před 4 lety

    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 Před 4 lety

      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!)

  • @joeldcanfield_spinhead

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

  • @udarakasun
    @udarakasun Před 6 lety

    You are Great kevin. Thanks lot.

  • @nonchalant8473
    @nonchalant8473 Před 6 lety

    Very helpful tutorial. Thanks

  • @celiafernandes9084
    @celiafernandes9084 Před rokem

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

  • @learner8084
    @learner8084 Před rokem

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

  • @harleyspeedthrust4013
    @harleyspeedthrust4013 Před 3 lety +1

    The straight line down is called a 'pipe'

  • @joshuaoseiawuah1157
    @joshuaoseiawuah1157 Před 2 lety

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

  • @tarek_maza
    @tarek_maza Před 2 lety

    | this is called vertical bar but most people refer to it as pipe.

  • @owaisrao4848
    @owaisrao4848 Před rokem

    what's the best thing how to remember these selectors?

  • @lollo4711
    @lollo4711 Před 4 lety

    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..]" ?

  • @Salmancreationbd
    @Salmancreationbd Před 5 lety

    Great Video . Thanks a lot , very helpful

  • @rodbrowning
    @rodbrowning Před 2 lety

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

  • @tomasslezak3628
    @tomasslezak3628 Před 6 lety

    Great tips, thanks.

  • @RH-nk7eo
    @RH-nk7eo Před 4 lety

    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  Před 4 lety

      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.

  • @hitthecity2
    @hitthecity2 Před 3 lety

    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 Před 3 lety +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

  • @basalduat
    @basalduat Před 3 lety

    Well Done Kevin. I am a frequent visitor.

  • @abhishekverma614
    @abhishekverma614 Před 4 lety

    Really helpful thanks a lot !

  • @ram-gb4xg
    @ram-gb4xg Před 4 lety

    thanks a lot!

  • @mikej7476
    @mikej7476 Před 5 lety

    Good stuff man, thanks.

  • @rslahmed383
    @rslahmed383 Před 5 lety

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

  • @celiafernandes9084
    @celiafernandes9084 Před rokem

    Please will you explain in deep sir on ~ tild selector

  • @theoglossa
    @theoglossa Před 3 lety

    Thanka for this!

  • @naczelnypsycholog6296
    @naczelnypsycholog6296 Před 2 lety

    what is the difference between * and * * or *>* , I use it a lot in CSS battles but honestly I don't know theory behind it xD

  • @Guinhulol
    @Guinhulol Před 6 lety

    Oh! Now I get it, these selectors work just like Regular Expressions operators.

    • @KevinPowell
      @KevinPowell  Před 6 lety

      Yup! Most people learning CSS don't know what those are though, so I didn't even think of drawing that parallel.

  • @minamishail_Tech2024
    @minamishail_Tech2024 Před 4 lety

    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  Před 4 lety

      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.

  • @rayediaz
    @rayediaz Před 4 lety

    Great content!