Select a range of content WITHOUT JavaScript



#css #shorts

Come hang out with other dev’s in my Discord Community
💬 https://discord.gg/nTYCvrK

Keep up to date with everything I’m up to
✉ https://www.kevinpowell.co/newsletter

Come hang out with me live every Monday on Twitch!
📺 https://www.twitch.tv/kevinpowellcss

Help support my channel
👨‍🎓 Get a course: https://www.kevinpowell.co/courses
👕 Buy a shirt: https://teespring.com/stores/making-the-internet-awesome
💖 Support me on Patreon: https://www.patreon.com/kevinpowell

My editor: VS Code – https://code.visualstudio.com/

I’m on some other places on the internet too!

If you’d like a behind the scenes and previews of what’s coming up on my YouTube channel, make sure to follow me on Instagram and Twitter.

Twitter: https://twitter.com/KevinJPowell
Codepen: https://codepen.io/kevinpowell/
Github: https://github.com/kevin-powell

And whatever you do, don’t forget to keep on making your corner of the internet just a little bit more awesome!

44 thoughts on “Select a range of content WITHOUT JavaScript”
  1. Neat trick! But maybe I'm just clueless, which is very likely, but I don't understand the pratical use case for this.
    If you want to target specific elements, surely there's some sort of dynamic render going on, in which case you do need JS, in the event of something changing and needing update.
    If that's not the case, wouldn't giving the elements a different class would be faster, more readable to less experienced devs and other people on your team, and ultimately achieve the same goal?

  2. This is really helpful for those of us interested in minimalist web design with no JavaScript. I scoffed at all the CSS tricks when I first started learning web development but now that I see how bloated most web pages are I'm glad your channel exists.

  3. Hey Kevin, this is an awesome tip 👍 😀 I have a similar issue. Maybe there is a solution for that too?
    I have a list where I want to select the 'li's from first to the one that has a specific class (e.g. .active). Basically, instead of from 1st to 5th element, I want from 1st to 'li.active'-element. It could be the third one or the 5th one. Is this also possible with css?
    Thanks for your great videos 😍

  4. Just got a 500 page book about TypeScript and I know pretty much everything it's trying to explain already but this is here is what kids call a big brain moment…
    …or in my words – forbidden magic.

Leave a Reply

Your email address will not be published.