CSS Before and After pseudo elements explained - part three: as design elements

  Рет қаралды 161,078

Kevin Powell

Kevin Powell

Күн бұрын

Exploring how to use ::before and ::after to create some fun design elements without any extra markup.
The before and after pseudo elements are great, since they let us add in content without any extra markup. This makes them perfect for adding in design flourishes, since we can do it without creating empty divs.
In this video, I first I look at using them to make a fun thing that can be used on headlines, and the second one a very fun hover effect that was inspired from this codrops article: tympanus.net/c...
Here is the CodePen: codepen.io/kev...
---
New to Sass, or want to step up your game with it? I've got a course just for you: www.kevinpowel...
---
My Code Editor: VS Code - code.visualstu...
How my browser refreshes when I save: • How to automatically r...
---
Support me on Patreon: / 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 KZbin channel, make sure to follow me on Instagram and Twitter.
Instagram: / kevinpowell.co
Twitter: / kevinjpowell
Codepen: codepen.io/kev...
Github: github.com/kev...

Пікірлер: 231
@rafabagrowski1918
@rafabagrowski1918 6 жыл бұрын
Amazing. I watched all 3 parts and immediately solved 6 issues at my job. Instant subscribe ;-)
@KevinPowell
@KevinPowell 6 жыл бұрын
Very awesome, so glad I could help, and thanks for subbing!
@konraddariuszwoloszyn9206
@konraddariuszwoloszyn9206 6 жыл бұрын
As always, Your videos are the top level of professionalism combined with great explanation and a healthy dose of humor. Great job!
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks so much for the kind words Konrad, really glad you're enjoying my content!
@fersahahmet9597
@fersahahmet9597 5 жыл бұрын
At last I found someone who really knows css and what he is doing. Not mimics some code learnt from some where else. Mr. Powell you ARE a pro. And thank you so much for all the effort putting these video series together
@tontonsan3534
@tontonsan3534 5 жыл бұрын
As a beginner, no online course was really explaining what you could do with ::before and ::after and I always thought "I'll get back to it later". Well, I finally took the plunge after your video appeared in my recommended autoplay after watching another tutorial, and I just had to leave a comment because you explain so well, and it is now so easy for me and I feel like you taught me in 1hour what several days of school would have. Thank you and you got a new subscriber :)!
@KevinPowell
@KevinPowell 5 жыл бұрын
Thanks for the sub Tontonsan, and I'm really glad you like my approach!
@justinpayne6845
@justinpayne6845 6 жыл бұрын
Thank you so much! After watching this series I now know how to make those little notification bubbles KZbin has telling how many new videos you have and like facebook uses for new posts and such.
@joeldcanfield_spinhead
@joeldcanfield_spinhead 5 жыл бұрын
Another excellent explanation. I think the reason this isn't used much is because it's all a bit abstract until you see examples. I suspect that as we all get more familiar and see more examples, there'll be ongoing creative use of pseudo elements like this.
@KevinPowell
@KevinPowell 5 жыл бұрын
I almost exclusively use them for design elements. It's actually good from an accessiblity point of view too, rather than adding extra markup that doesn't actually have a purpose other than looking pretty :)
@philkewley
@philkewley 2 жыл бұрын
I had an idea replace a blocky looking footer section with a simple text based section, but that meant finding a way to separate content without using background colours or images - I've watched this video so many times over the years without fully understanding how I could use it. And now today when I needed inspiration and direction I remembered it! So I follow everything on the video and place a 50% height before & after behind h3 text, set the after color to transparent, reduce the height to 50%, give it a 3px border-top and push it down using vh, until I've basically got a horizontal rule with the brand name nicely centred. I even managed to place it all in a centred container so it only takes up 90% width. It looks a lot better than that messy description - Honestly I can't thank you enough for sharing so much knowledge, your teaching keeps me going forwards. Thank you
@dyllanmccreary688
@dyllanmccreary688 6 жыл бұрын
Wow. Watching this series i expected to only learn about ::before and ::after pseudo elements. not only did i learn that but you helped me fix a few issues i was stuck on. thanks guy, great videos.
@KevinPowell
@KevinPowell 6 жыл бұрын
Very awesome, glad it helped Dyllan!
@amysheeter877
@amysheeter877 2 жыл бұрын
You're the best. Just finished this series, and I was trying to do something similar to this on a website I am currently working on but could NOT figure out how to make it look good. This answered all my questions. Thank you for your amazing work!
@aminedrouche5465
@aminedrouche5465 2 жыл бұрын
You got my brain working 😂 i was thinking with you along the video to find out how to do it. Awesomeness is a fact 😍😍 thank you
@seemsas
@seemsas 6 жыл бұрын
I am more of the backend guy but your videos makes me more and more interested in frontend coding. Thank you!
@KevinPowell
@KevinPowell 6 жыл бұрын
That's awesome. Backend scares me, lol.
@MVIVN
@MVIVN 2 жыл бұрын
I'm still very, very early in my front-end journey but watching stuff like this blows my mind! I can't wait until I get to a point where I am implementing stuff like this into my sites!
@octavian3033
@octavian3033 4 жыл бұрын
Wow!! Watching these videos is like having your mind opened to a new CSS multiverse where anything is possible.
@riyazahamed5378
@riyazahamed5378 3 жыл бұрын
Wow, ::before watching this video i assumed that i know something about css, but ::after i realized i am doing css in a wrong way, Thank you Sir (immediately subscribed )
@adityads1339
@adityads1339 4 жыл бұрын
Watched all 3 videos that were part of the series. Great content! I can confidently say that I understand ::before and ::after, so much better than before. Thank you so much!!!
@ilhambagirov571
@ilhambagirov571 3 жыл бұрын
Ohh God. Finally i found someone who could explain me what these elements do. Thanks a lot for giving this valuable knowledge to us. 👍🙏
@santiagocalvo
@santiagocalvo 3 жыл бұрын
im learning CSS and your channel is the BEST!!! thnx a lot!!!
@sravant
@sravant 9 ай бұрын
Your channel deserve 10 million subscribers. Thanks for all the videos Kevin.
@brandonv8525
@brandonv8525 2 жыл бұрын
Your videos are pretty good, I speak Spanish but I better understand your videos than the other videos in my language
@MrTanguero
@MrTanguero 3 жыл бұрын
Loved all three parts of the series and that link you shared also has some amazing ideas! Thanks a lot, Kevin!
@bpavanellic
@bpavanellic Жыл бұрын
Kevin, realy thank u for this series of videos. Love from Brasil .
@nerozone84
@nerozone84 3 жыл бұрын
Your videos are great. I just watch any video you have randomly and find a solution to a problem I have in a design. Like in this video, I didn't realise I had to go set box-sizing on before and after psuedo elements. I was wondering why a psuedo element I had wasn't quite lining up the way I expected. Thanks!
@jeffjarvis222
@jeffjarvis222 4 жыл бұрын
I enjoy your videos. A super-easy way to style the .intro class "Generic Heading" is with grid using grid-template-columns: 1fr auto 1fr. (I learned this by watching your videos about grid, heh). Add a small grid-gap for white space around the text. Now the ::before and ::after elements just need background color and you're done! Keep up the excellent work, Kevin.
@johnthiongo4305
@johnthiongo4305 3 жыл бұрын
I have a new found respect for css thanks to you
@cyndikirkpatrick7578
@cyndikirkpatrick7578 5 жыл бұрын
I sure have learned a lot from you. Thank you.
@jeffdunham541
@jeffdunham541 Жыл бұрын
These videos are GREAT! Thank you so much for sharing.
@travisantoniello
@travisantoniello 4 жыл бұрын
Great series - this totally demystified ::before and ::after for me, and it was inspiring to see what's possible with them. Thank you!
@vijais5692
@vijais5692 4 жыл бұрын
You are my all time favourite instructor in youtube ❤❤❤❤❤
@MroMroMarc
@MroMroMarc 4 жыл бұрын
Man! Im speechless! This is so fun and useful! Ive already said that but you are a great instructor. I wish I could afford some monetary gratification like buying your course. I will, someday soon. For now, thank you very much.
@kelvinsmith4894
@kelvinsmith4894 5 жыл бұрын
Watched the complete 3 parts on TV, had to grab my laptop to comment, like and subscribe!!! Thank you Kevin...
@KevinPowell
@KevinPowell 5 жыл бұрын
Thanks so much Kelvin, glad you liked it enough to take the time to do that! Thanks for the sub :D
@wiecek00
@wiecek00 3 жыл бұрын
You are providing really great content Kevin. I started watching your channel and learned a lot of new things as well as solidified my knowledge. Thanks for your help and keep up the good work! I already subscribed :)
@360theosiris
@360theosiris 2 жыл бұрын
This stuff is amazing and completely changed my view on what is possible with just css.. Thanks for this! Subscribed
@22D011AROCKIAVIMALJAPSONA
@22D011AROCKIAVIMALJAPSONA 9 ай бұрын
For these kind of effects, outline - offset with some transitions also cool.👍👍
@mo3ad96
@mo3ad96 5 жыл бұрын
As always, Your videos are the top level of professionalism thank you so much
@CliveStephensonCoUkDesigner
@CliveStephensonCoUkDesigner 6 жыл бұрын
Fabulous Kevin, you have a real skill for explaining things
@marikabasagoitia6828
@marikabasagoitia6828 3 жыл бұрын
Thank you so much for this! This really cleared up before and after pseudo elements for me and helped create a really cool effect on a page I’ve been working on.
@jenniferward6821
@jenniferward6821 3 жыл бұрын
Thanks Kevin watched all three and lights went on!
@jimdart8219
@jimdart8219 6 жыл бұрын
Kevin, once again thank-you for the details on how all this works and why. Just had a thought (it happens now and then). Have you ever considered explaining the planning stages for building a website. What goes on before we hit exclamation tab.Thanks again Kevin, you have raised my ability 10 fold.
@KevinPowell
@KevinPowell 6 жыл бұрын
I sort of talked about it once very briefly in one of my other videos, but I am about to start redesigning my personal site. I'm pretty much in the ideation phase at the moment. I should totally make some videos of what I'm doing and how I'm approaching it.
@rasul3d
@rasul3d Жыл бұрын
I like using before and after as a nice colorful thick underline that is 30% of the width of content.
@yoSn4p
@yoSn4p Жыл бұрын
Thank you master, all explained clearly!!
@insaneviruss
@insaneviruss 5 жыл бұрын
Really enjoyed the video, the pacing and your entire thought process. *First timer on the channel* *subscribed*
@KevinPowell
@KevinPowell 5 жыл бұрын
So glad that you enjoyed it so much, and a big thank you for the sub :)
@akinyemiolalekan1681
@akinyemiolalekan1681 3 жыл бұрын
This is simply awesome.....Great job...
@ricard112
@ricard112 5 жыл бұрын
These videos are gold. Thank you for sharing.
@karstenlehmann13595
@karstenlehmann13595 2 жыл бұрын
Thanks a lot for these three videos!
@colindante5164
@colindante5164 3 жыл бұрын
One of the most overlooked selectors to overcome glitches when working will rollovers. In this presentation (referring to the codepen) its .card:hover .card__text {opacity: 1;} This will target Any element with a class name of 'card_text' that descends from an element that is hovered on with a class name 'card' .
@anishjoshi1999
@anishjoshi1999 2 жыл бұрын
This man a legend
@SothearithKONGMrMuyKhmer
@SothearithKONGMrMuyKhmer 3 жыл бұрын
Thanks Kevin; that’s amazing! 👏👍
@alainstross3108
@alainstross3108 2 жыл бұрын
Kevin, you're a boss
@shashankdasaniya
@shashankdasaniya 6 жыл бұрын
This is really a great learning for me,from watching your videos. Thumbs up !
@travisbburch
@travisbburch 4 жыл бұрын
this was fantastic - can't wait to watch your other videos
@daniamsalem
@daniamsalem 4 жыл бұрын
This is a fantastic video, upping my skills and code cleanliness.
@thiagoterceiro9902
@thiagoterceiro9902 5 жыл бұрын
Amazing series of ::before and ::after!
@benyamin4634
@benyamin4634 2 жыл бұрын
i will really be gladful if you put an extra pen for the initial codes so i can code along with you . it becomes really difficul to remove that extra code then write it again along with you . thanks for your wonderful tutorials :3
@Swiftrunner10123
@Swiftrunner10123 3 жыл бұрын
You are incredible! Thank you so much!
@maheshbeeravelli
@maheshbeeravelli 6 жыл бұрын
Awesome content worth watching. How did I miss to watch this content before.
@KevinPowell
@KevinPowell 6 жыл бұрын
Glad you're liking it 😁
@maheshbeeravelli
@maheshbeeravelli 6 жыл бұрын
Kevin Powell shared with all my peers (y)
@pettgree
@pettgree 4 жыл бұрын
dudes, CSS seems awesome after this tutorial 🤣 Thanks Kevin
@lucadifazio2735
@lucadifazio2735 3 жыл бұрын
Awesome. This is incredible
@tilakmadichettitheappdeveloper
@tilakmadichettitheappdeveloper 4 жыл бұрын
I watched all 3 parts - this is so cool !
@kristianulvund4274
@kristianulvund4274 4 жыл бұрын
Awesome, Kevin🤩 CSS is so much fun!
@keithho5335
@keithho5335 5 жыл бұрын
just found your channel. IM HOOKED
@zt.5677
@zt.5677 4 жыл бұрын
Good material. Thank you.
@mahdijafaree5332
@mahdijafaree5332 2 жыл бұрын
Awesome! You are Perfect! thanks!😃
@herveboulangue6051
@herveboulangue6051 6 жыл бұрын
Thank you Kevin. Love your tips !!! Very usefull and clear as usual :)
@kush0602
@kush0602 4 жыл бұрын
It's only your X, which changes.. LOL ;)... Jokes apart you are a great tutor.. Thanks
@jijiwaiwai
@jijiwaiwai 5 жыл бұрын
Thank you! I learned a lot
@ya-juchang5099
@ya-juchang5099 6 жыл бұрын
Thank you so much! That is amazing and you are definitely a good teacher!
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks a lot, glad that you liked the video :D
@melbournemeliodas215
@melbournemeliodas215 5 жыл бұрын
Phew, Exam secured! Thank you Kevin Powell! Im going to watch all of your series after my Exam, but can I ask if you have like a playlist?
@KevinPowell
@KevinPowell 5 жыл бұрын
I have a bunch of playlists :)
@marcel-vc
@marcel-vc Жыл бұрын
I came up with the following solution to add the red bars around the title: .intro { display: grid; grid-template-columns: 1fr auto 1fr; grid-gap: 0.1em; } h1::before, h1::after { content: ''; background: $clr-red; } It works in the CodePen but I'm not sure if there are any drawbacks to it.
@soumya_r_mohanty
@soumya_r_mohanty 5 жыл бұрын
Excellent explanation Kevin. Could you please explain more about how .card::before goes behind image without setting any z-index on it.
@danielkim4487
@danielkim4487 6 жыл бұрын
Really cool. thanks for the lesson Kevin!
@BenRogersWPG
@BenRogersWPG 3 жыл бұрын
Outstanding
@redisick
@redisick Жыл бұрын
This is so cool!
@OmarAshrafBombo
@OmarAshrafBombo 3 жыл бұрын
You are the one man ✌🏼 thank U
@from9835
@from9835 5 жыл бұрын
Man,Videos are very on point and this is one of the top channels in Web Development,but i think you speak to fast,if i hit 0.75 speed then is too slow. If you can make 5% voice slower it will be great.Thank You!
@KevinPowell
@KevinPowell 5 жыл бұрын
Haha, I'll try my best, I know I get carried away at times
@carlosrangel4500
@carlosrangel4500 2 ай бұрын
Amazing content
@osmbj1377
@osmbj1377 4 жыл бұрын
Awesome, thanks
@dre429
@dre429 Жыл бұрын
Thank you so much!
@peekaboo6026
@peekaboo6026 3 жыл бұрын
I can't thank you enough.
@thuanle9444
@thuanle9444 5 жыл бұрын
Thanks @Kevin.
@arya_bakh
@arya_bakh 5 жыл бұрын
Great Job bro
@pagarevijayy
@pagarevijayy 3 жыл бұрын
this is awesome!
@mohdsaquib380
@mohdsaquib380 4 жыл бұрын
Really loved it. You killed it ✌️
@HEKuiper
@HEKuiper 6 жыл бұрын
I would replace the right and left positioning with "   "
@KevinPowell
@KevinPowell 6 жыл бұрын
I wouldn't use non-breaking spaces in my HTML for very much just because it's a lot easier to make changes to it later if everything is in the CSS. HTML = content, CSS = style. Non-breaking spaces have a purpose, but using them to trick layouts can cause some issues in the long run. Same reason I wouldn't use them to space items out, and instead use margins. Also, what if I wanted the space to be a lot bigger? Would I then need 10 non-breaking spaces? Also, in general, I like to think that I'm writing code that someone else might be editing one day. Would someone else think of looking for that in the HTML, or would they assume it's in the CSS? For a personal project it might be a different story obviously, but most of the time we're working in teams, or on projects that will, at one point, eventually, have someone else making changes to it.
@tomnagy2439
@tomnagy2439 3 жыл бұрын
Great stuff !
@KevinPowell
@KevinPowell 3 жыл бұрын
Thanks so much!
@inayathkhan100
@inayathkhan100 5 жыл бұрын
Great Tutorial Kevin
@duke1sanj1
@duke1sanj1 6 жыл бұрын
Excellent as always 👍👍👍
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks Sanjay!
@huzaifarasheed2313
@huzaifarasheed2313 3 жыл бұрын
Great video
@marjan5170
@marjan5170 2 жыл бұрын
Thank you for this 🤩🤩🤩🤩🤩
@JustJordano
@JustJordano 4 жыл бұрын
Tank you, you really helped me there.
@samuelfischer3764
@samuelfischer3764 3 жыл бұрын
pls cover ::selection
@shashwatpal8626
@shashwatpal8626 3 жыл бұрын
hail down to the Css king
@andersonhall08
@andersonhall08 6 жыл бұрын
subscribed... these are great videos, man. Thanks!
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks so much for the sub Andy! So glad to hear that you're enjoying my videos!
@xerxius5446
@xerxius5446 4 жыл бұрын
Always wondered how this worked, Now I know
@TheSETJ
@TheSETJ 6 жыл бұрын
I can only say: Amazing!
@KevinPowell
@KevinPowell 6 жыл бұрын
Glad you liked it :)
@doritoflake9375
@doritoflake9375 4 жыл бұрын
Might be a dumb question but I don't understand why you had to separate out the lines in before and after...couldn't you have done everything in before and achieved the same effect?
@shimphillip
@shimphillip 6 жыл бұрын
Good job. Your videos are superb.
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks Phillip!
@MohammadSyedhasan
@MohammadSyedhasan Жыл бұрын
why my border property on .card::before isn't working ??any solution?
@gajjalaharsha
@gajjalaharsha 3 жыл бұрын
If we dont keep position:relative , then background color will take entire screen?
@killDJuice
@killDJuice 6 жыл бұрын
I am so glad i found you😂😅
@Nicolas5095
@Nicolas5095 2 жыл бұрын
It doesn't work for me to declare &::before and &::after inside a block of code, it shows me an error saying I'm missing a "{" lol
5 CSS mistakes that I see way too often
19:03
Kevin Powell
Рет қаралды 359 М.
Before and After pseudo elements explained - part one: how they work
9:08
HAH Chaos in the Bathroom 🚽✨ Smart Tools for the Throne 😜
00:49
123 GO! Kevin
Рет қаралды 13 МЛН
GIANT Gummy Worm Pt.6 #shorts
00:46
Mr DegrEE
Рет қаралды 32 МЛН
Learn CSS Grid the easy way
37:04
Kevin Powell
Рет қаралды 909 М.
Unbelievable AI Tool Converts Figma to Code🔥
17:46
Tech With Tim
Рет қаралды 293 М.
Three fun uses for  ::before and ::after
12:04
Kevin Powell
Рет қаралды 127 М.
Floats, Flexbox, Grid? The progression of CSS layouts
27:00
Kevin Powell
Рет қаралды 288 М.
CSS Selectors - beyond the very basics
18:47
Kevin Powell
Рет қаралды 42 М.
CSS Pseudo elements Before and After: Examples
11:55
Анна Блок
Рет қаралды 102 М.
How to Do 90% of What Plugins Do (With Just Vim)
1:14:03
thoughtbot
Рет қаралды 895 М.
A look at the CUBE CSS methodology in action
47:09
Kevin Powell
Рет қаралды 104 М.
The Magic of CSS Grid AUTO-FIT vs AUTO-FILL
11:25
DesignCourse
Рет қаралды 180 М.