The before and after pseudo elements are super useful part of CSS, but are often misunderstood. This is part of a three-part series where I look at how they work, and cool stuff we can do with them.
In this video, I focus on what ::before and ::after even are and how we can use them, and even why we use the double colon before them, instead of a single one (it's to distinguish them from pseudo-classes, like :hover).
One important thing with both the before and after pseudo elements is that they require us to define the content property. Without it, it defaults to none and, well, we can use it!
New to Sass, or want to step up your game with it? I've got a course just for you: https://www.kevinpowell.co/learn-sass
My Code Editor: VS Code - https://code.visualstudio.com/
How my browser refreshes when I save: https://youtu.be/h24noHYsuGc
Support me on Patreon: https://www.patreon.com/kevinpowell
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.
I'm a full stack. Sometimes we don't get all the design memos.
I just happened to notice your video in the suggestions and you had me at p::before....
This is really helpful! I've used "before" and "after" when I'm solving problems based on internet suggestions, but i really had no idea what i was doing expect making styles "before" and "after" So thanks for making this! Very helpful!
I don't really use floats very often anymore! I use grid for most work now, and if browser support is an issue, then flexbox. It sounds like the issue might be needing a clearfix in your situation, so you could look that up, CSS tricks has some good articles on it.
Seriously I appreciate your content! :D I'm also glad you replied because I realized now that I forgot to subscribe to your channel xD Currently doing a 2-year front end developer course online. Think I'll get a lot out of your videos, we use Lynda but those tutorials often gets too dry and boring.
Hi Kevin. Glad I found your channel. Thanks a lot for this series and the great explanation. But could you please, if it not bother you. Can you slow down a bit so that I can keep up? You talk too fast for me, sometimes.
Really sorry about that. You're not the first to mention it, and u try to keep it in mind, but sometimes I get carried away. Worst case you can hit the settings and change the speed to slow it down, but I'll try to keep it in mind more!
I did just learn recently that because of how browsers render broken images, you can have pseudo-elements on those! In some browsers anyway... so strange, hah. But yes, with normal images I learned the hard way as well!
Pretty universal, going pretty far back. IE8 only supports the ::before and ::after with a single colon (so, :before and :after, which is non-standard now), so if you need support that far back, it is possible :). There should be no issue at all in using psuedo-elements today at all. Where you can get in trouble is if you want to transition or animate the pseudeo elements, as not all browsers support that (namely IE and Safari)
This is the 2nd video I watched and then?
Subscribed. Awesome explanation and with also clear examples. Before this, I saw at lots of places those" before" and "after" pseudo stuff but I didn't understand. Now I did. And just when I needed. Thanks Dude. You're freaking awesome. Your channel deserves more attention.
Kevin, hello . Thanks for the explanations on how these work. This is what is needed on YouTube, how it works and why, plus the other things that can be done. I for one need to know how things work and not just put this here or there. Once again thank you. I also think you will be resposible for creating some awsome developers and designers. Have a good day a
Thanks Jim! I really agree, I've seen too many videos that clearly have the finished code off-camera, and they just type everything in and it works perfectly, with no real explanations. It's not how someone does it, but WHY they do it that matters most. One of the reasons I started this channel :).
We need to make a website as a school project and I'm glad to have your tutorials! Our teacher doesn't know anything about this cool stuff... He doesn't know what css is and he is teaching html for many years now.
Thank you Kevin, I've wating for you to make this video.. now I can't wait to watch next two videos about pseudo element.
Really, I use to use :before instead of ::before and now I know why I should use :: before.
Thank you again 😊
I thought the same thing forever too David. I forget when I realized that it didn't work that way. With the way we use them (and how they are named), it just makes sense that they'd be before and after the element itself. Makes it easier to use that it isn't though :).
P.S (Trying to help, not be rude) You can use the past tense verb 'thought' by itself, or use the future tense verb 'think' prefixed by 'did' to make it past tense; ie. "I did think..." or "I thought..." but not "I did thought..." Generally though just stick with the single past tense verb.
Awesome! I thought that for the longest time too. Probably because that makes sense with how it's named, and even how we use it a lot of the time... but as we know, CSS is often the opposite of intuitive.
Learning how to draw cartoon animals from the farm is not such a difficult task! Weve grown up surrounded by them! Farm animals are everywhere: In blockbuster movies, childs books, greeting cards. their shapes and images are printed in our minds!
In this section, I will show you how to determine what are the physical uniqueness of each animal and how to work with them. Then, you can practice drawing each cartoon character using basic shapes.
You will have the opportunity to make nice illustrations, practice sketching and cartooning using short easy lessons and complete your creation using a drawing software to create vector art if you want to! Cartoon drawing is really fun once you get into it!
Dont be afraid to try until you get it right. This method is really simple, but requires practice and observation. So, sit back and relax. Learn how to draw animals from the farm and start your journey on a good note!
Lets try s few basic characters to get started! :)
A cute turkey to begin with.
In this first tutorial, you can learn how to draw a fun turkey mostly made from small rectangles and large circular shapes. The posture of the character is really interesting. Not only is it easier to draw than a front version, but its also easier to add some perspective (as we can see with the legs). The fact that we just need to draw one wing is also interesting.
Most of these cartoon animals are not filled with complex textures or digital effects. In this case, the subject is filled with plain colors and only a few basic details (inside the tail) were added.
A nice turtle also from a side view.