3 Box Shadow Tricks You MUST Know

Поділитися
Вставка
  • Опубліковано 3 лис 2024
  • Box shadows can make things look nice, but they can also be used in unusual ways to pull off some fun effects as well!
    In this video, I look at three hacks that you can use with box-shadow: faking multiple borders, a modal 'background' with no extra markup, and a peeled corners effect.
    Codepen: codepen.io/kev...
    ---
    I have a newsletter! www.kevinpowel...
    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 UA-cam channel, make sure to follow me on Instagram and Twitter.
    Instagram: / kevinpowell.co
    Twitter: / kevinjpowell
    Codepen: codepen.io/kev...
    Github: github.com/kev...

КОМЕНТАРІ • 99

  • @bloxzyo
    @bloxzyo 3 роки тому +1

    Wooooow! This is the best box shadow series.... making them all inset to not affect the box model was a genius idea.....

  • @sumankathet2560
    @sumankathet2560 6 років тому +54

    The thing I like about your videos is that you always do something that we could use in our real world projects.... I follow many other web developer youtubers but the content I find in your videos, I found in none...
    Thank you very much sir😊😊

    • @KevinPowell
      @KevinPowell  6 років тому +7

      Thank you so much for the kind words, and I'm really glad you're finding a lot of value in my videos! Thanks so much 😊

    • @ayazaslam1362
      @ayazaslam1362 2 роки тому

      U creat problems in your head and then make tutorials oh I think of 200px shadow and it's a problem.
      Who gives 200px shadow?
      There is command margin . 3:25

  • @The-Average-Gamer
    @The-Average-Gamer 6 років тому +38

    The modal shadow trick is really cool, thank you.

    • @KevinPowell
      @KevinPowell  6 років тому +5

      No problem at all, glad you liked that one :).

    • @kirkanos771
      @kirkanos771 4 роки тому +3

      @@KevinPowell One of the reason i'm not using that trick and i add elements (an overlay) anyhow is because i need the shadow part to be clickable/triggering cancel/close events.

    • @Nerwesta
      @Nerwesta 4 роки тому

      @@kirkanos771 good point.

    • @kelvinclark3474
      @kelvinclark3474 3 роки тому

      So much learnt thank you

  • @josema-boy7610
    @josema-boy7610 5 років тому +9

    This video was definitely my cup of tea. Thank you very much. Cheers!

  • @jennyjanssen1499
    @jennyjanssen1499 3 роки тому +3

    Absolutely love the Peel effect. Thank you for showing how to get this done.

  • @christopherikpat5512
    @christopherikpat5512 6 років тому +15

    thank you kevin. my confidence keeps getting better with your videos. much appreciated

    • @KevinPowell
      @KevinPowell  6 років тому +3

      That's great to hear Christopher! Keep it up 👍

  • @shubham0638
    @shubham0638 5 років тому +5

    I never understood css this good in past year as much I learned from your channel in just 1 month.

  • @kamaboko1
    @kamaboko1 6 років тому +4

    Given the sheer volume of content providers on UA-cam it is difficult to create one's own style, while delivering quality content at the same time. You have achieved both.

    • @KevinPowell
      @KevinPowell  6 років тому +1

      Wow, thank you so much kamaboko1! I really appreciate it!!! 😁

  • @nitram_nosnibor
    @nitram_nosnibor 3 роки тому

    Oh maaaan the peeled corners effect it pure genius!!! Loved this series, thanks Kevin.

  • @andreaskarz
    @andreaskarz 3 роки тому

    Wow, the modal hack it's really amazing. Thank you

  • @suthakharponnambalam9836
    @suthakharponnambalam9836 3 роки тому

    It's 2021 and here I am searching "Kevin Powell box-shadow prop", thanks to Kevin for all the amazing content!

  • @gabiold
    @gabiold 5 років тому +3

    Pretty surprised I did just found your channel! I like these great little things which are very useful in real-word building bigger things!

  • @ralexand56
    @ralexand56 5 років тому +2

    Beautfiul! Always wondered how that peeled corner effect was made.

  • @thomasmeiller4455
    @thomasmeiller4455 5 років тому +2

    thks. I learned just another cool things about box-shadow's functionality + features!

  • @Nikkupikku123
    @Nikkupikku123 5 років тому +1

    I am so glad I came across your channel . Thank you.

  • @FilipeFreire
    @FilipeFreire 4 роки тому

    man, it's amazing how much I learn from watching your videos.. this video was top notch! Thank you so much!

  • @SmokeyNinja45
    @SmokeyNinja45 5 років тому

    Your videos are truly the best I've seen. They are very helpful.

  • @AmirulIslam-gg2fn
    @AmirulIslam-gg2fn 6 років тому +1

    Thanks a lot. I have learnt a lot about box shadow from your box shadow series.

    • @KevinPowell
      @KevinPowell  6 років тому

      Glad to hear that you've learned a lot 👍

  • @Ninjer
    @Ninjer 5 років тому

    GENERAL KENOBI. YOU ARE A BOLD ONE

  • @CarAudioInc
    @CarAudioInc 4 роки тому +1

    thanks so much for your effort, your videos are awesome, definitely my favorite webdev youtuber

  • @Morrile1
    @Morrile1 6 років тому +1

    As usual, as very useful video on how we can improve presentation. Many thanks 👍

  • @JacoblBroughton
    @JacoblBroughton 5 років тому

    your channel is a goldmine

  • @Ben.Jacobsen
    @Ben.Jacobsen 4 роки тому

    Thank you!

  • @tomchrist4908
    @tomchrist4908 3 роки тому +2

    Another fun hack is that since the box-shadow starts at the edge of the box, so you can use a transparent div to create a window through a dark screen to the content below. Then absolute position and size your window to put it over content you want to highlight.

  • @miloskostic2239
    @miloskostic2239 5 років тому

    Thank you for this great lesson, the modal and the last trick are very useful.

  • @LanFeusT23
    @LanFeusT23 4 роки тому

    Awesome video as usual!

  • @seize2581
    @seize2581 4 роки тому

    Thanks ! I'll be sure to use them more often :)

  • @SazikimiJaeger
    @SazikimiJaeger 6 років тому

    These tricks are really handy. Specially that modal one. Thanks a lot man. No I can save my mark up a lot and my code will be more optimized. I really appreciate your teaching, very understandable and easily explained. Thanks again for making these awesome videos. I can learn a lot.

  •  4 роки тому

    Really good video and explanation, thank you Sir, hope we can get more like this creative videos

  • @mareksawinski8225
    @mareksawinski8225 6 років тому +1

    Awesome. Thanks Kevin.

  • @sevketiskender3229
    @sevketiskender3229 5 років тому

    Thank you Kevin!

  • @nagahumanbeingzooofparticl8836
    @nagahumanbeingzooofparticl8836 6 років тому

    Very helpful for Beginners.. thanks man!👍

  • @webdesigner8904
    @webdesigner8904 6 років тому +1

    REally AWesome!

  • @ridaazzabi3233
    @ridaazzabi3233 5 років тому

    Very Professional!!!

  • @abdelmonaemshahat412
    @abdelmonaemshahat412 6 років тому

    thanks kevin it's pretty mini course on box shadow property . i hope u do more on border radius and gradient background .thanks again

    • @KevinPowell
      @KevinPowell  6 років тому

      I've got some things lined up for gradients, should be about a month or so away :D

  • @nathancornwell1455
    @nathancornwell1455 5 років тому

    i found that you can use box-shadow to make your buttons look like they are actually being depressed. you can make this effect by putting a box-shadow on your button then use the :active pseudo class and make the box-shadow offsets and spread smaller values....and can take it even one step further by using the transform: scale() to make it slightly smaller to like .9 or .95

  • @arampianist
    @arampianist 3 місяці тому

    The negative z-index makes the elements invisible… I think, unless you set a positive z-index on the parent element as well. I think setting isolation to isolate on the main element also makes it work..

  • @curtreyes00
    @curtreyes00 5 років тому

    I recently used box shadow to create an aperture effect. I made an invisible circle with a giant black shadow. I thought it was pretty neat

  • @hattorihanzo5707
    @hattorihanzo5707 3 роки тому

    king of css

  • @UrraSergio
    @UrraSergio 5 років тому

    15:51 I loved it.

  • @nuwang1
    @nuwang1 5 років тому

    Awesome

  • @clevermissfox
    @clevermissfox Рік тому +1

    Do gradients work on box shadows?

  • @joeldcanfield_spinhead
    @joeldcanfield_spinhead 5 років тому

    I love this kind of creative geekery.
    It's probably unintentional, but I've noticed in more than one video you refer to "vertical width" instead of "viewport width." Unless I'm missing something.

    • @KevinPowell
      @KevinPowell  5 років тому

      Yup, I say vertical sometimes and don't catch myself.... My brain gets caught up on that "v" :\

  • @AntoniGawlikowski
    @AntoniGawlikowski 2 роки тому

    "You need that? No."

  • @braveshine2579
    @braveshine2579 3 роки тому

    done

  • @fatach22
    @fatach22 6 років тому

    Hi Kevin, I liked the page peel effect, however using z-index is problematic for me, as it conflicts with other elements (basically its behind EVERYTHING). Do you know of a hack to solve this one? :O

    • @KevinPowell
      @KevinPowell  6 років тому +1

      You can give the parent element a position: relative; That should change it's layering context (z-indexing is weird). You can layer the parent, and then it's pseudo elements are only z-indexed in relation to it, and not everything else (sort of). And very poorly explained by me here, hopefully it makes sense.

    • @fatach22
      @fatach22 6 років тому

      Kevin Powell thanks! Will give that a try

  • @fufumitgemuese
    @fufumitgemuese 5 років тому

    box-shadow on a modal-element is pretty useless besides the looks, because you still can interact with your page "behind" the dialog

  • @nikhiltyagi2223
    @nikhiltyagi2223 6 років тому

    Video Request! Can you please do the next video on pure vanilla js slider(with slding transition) with navigation dots and prev next button without using any of those plugins like wow slider or owl carousel. Part one a full carousel header slider...and part 2 a content slider with 3-4 boxes in view at a time.

    • @KevinPowell
      @KevinPowell  6 років тому

      Definitely won't be the next video, but I could look at doing something like that in the future!

  • @wtfgreg1246
    @wtfgreg1246 Рік тому

    I don't understand why when I copy this into an HTML/CSS file it doesn't work for me. The before/after don't show at all...

    • @wtfgreg1246
      @wtfgreg1246 Рік тому

      If I add a rotate(0deg) to the parent it does though

  • @kevinrichter9397
    @kevinrichter9397 6 років тому +1

    Hey Kevin,
    thanks for this great tutorial. I just tried the peeling box shadow effect on my project. It works like a charm. Only when I hover the box itself with box:hover {transform: translateY(-10px) scale(1.05)}, the box::before and box::after are stacked on top of the box even though they have the z-index: -1.
    Here's the code: codepen.io/oceandiveloper/pen/ZMBLZb
    I read about the stacking context of transforms but I'm still not really sure what to do to solve this. Do you have a fix for that?
    Cheers, Kevin

    • @KevinPowell
      @KevinPowell  6 років тому

      Stacking context can be annoying. I do have a video on it that might help (ill link it at the end here, cause a bit of a long answer). When you put the :hover effect on your .box, it has a transform on it, and that transform gives your .box a new stacking context. So now, the ::before and ::after are not stacking according the the document's stacking context (where the -1 z-index will push them backwards), but will instead push it to the back of this new stacking context, so the only thing they are now behind is the h1 inside your box. Which is terribly annoying.
      Here is my video: ua-cam.com/video/uS8l4YRXbaw/v-deo.html

  • @oiurehj
    @oiurehj 6 років тому

    + Shadows...yeah, i know how to use shadows...
    - And then you can do this, or, if you want, you can do this...
    + Wait, what was that sorcery?

    • @KevinPowell
      @KevinPowell  6 років тому

      Haha, glad that the video wasn't a waste of time :)

  • @gosnooky
    @gosnooky 4 роки тому

    Neat

  • @coolgamer6458
    @coolgamer6458 6 років тому

    can you make a video describing position???

    • @coolgamer6458
      @coolgamer6458 6 років тому

      i am really confused about this

    • @coolgamer6458
      @coolgamer6458 6 років тому

      well i want make a portfolio site.The nav bar is creating the problem..

    • @coolgamer6458
      @coolgamer6458 6 років тому

      do you have any facebook id???

    • @KevinPowell
      @KevinPowell  6 років тому +1

      I have this video that sort of looks at the basics of it cool gamer: ua-cam.com/video/P6UgYq3J3Qs/v-deo.html and this one where I do some more stuff with it: ua-cam.com/video/lUaw-AA9HnA/v-deo.html
      Hopefully Jos van Weesel's been able to help you out, but if you have any questions let me know :)

    • @coolgamer6458
      @coolgamer6458 6 років тому

      thank you.your video is helping me a lot.

  • @ek1311
    @ek1311 6 років тому

    1 000 000 $ Man!

  • @jenniferward6821
    @jenniferward6821 3 роки тому

    Ditto

  • @angelcaru
    @angelcaru 5 років тому

    7:20
    ONE HUNDRED VERTICAL WIDTH?!?

    • @KevinPowell
      @KevinPowell  5 років тому

      I just wanted a really big value. It could be smaller, but you could set it to 1000vw and get the same result. Shadows won't cause any overflow issues, so if you want to cover the entire space, why not overshoot it?

    • @angelcaru
      @angelcaru 5 років тому

      @@KevinPowell But you said VERTICAL WIDTH instead of VIEWPORT WIDTH

  • @summonshr
    @summonshr 6 років тому +2

    You should check out stackblitz.com. It is an awesome development tool. As always, thank you for videos.

    • @KevinPowell
      @KevinPowell  6 років тому

      That looks really cool, thanks for sharing it summon shresth!

  • @devincenatiempo2238
    @devincenatiempo2238 6 років тому

    I did a little analog clock project where the shadow changes with the moving hands for a realistic effect. It is very subtle but I think it works well.
    It uses JS and a little trigonometry.
    I’d like to have done this with purely CSS, but I don’t think it would be possible. I’d love someone to prove me wrong...
    dcenatiempo.com/cit-261/clock/

    • @KevinPowell
      @KevinPowell  6 років тому

      For some very basic proof of concept, I threw this together: codepen.io/kevinpowell/pen/ermOwV
      It's far from perfect as far as positioning things, I was more worried about the animation than anything else.
      I stole the shadow animation that you created, very nicely done with the viewport units in there, really dig that a lot!

    • @devincenatiempo2238
      @devincenatiempo2238 6 років тому

      Thanks. Yeah its funny, It turned out being a lot more complex project than I imagined at the start.

  • @MuhammadAdnan-gx6rd
    @MuhammadAdnan-gx6rd 6 років тому

    also teach javascript like this example

    • @KevinPowell
      @KevinPowell  6 років тому

      I don't know where to start with JS! It's a much bigger topic than CSS, I never really know how to approach it.

  • @ayazaslam1362
    @ayazaslam1362 2 роки тому

    U creat problems in your head and then make tutorials oh I think of 200px shadow and it's a problem.
    Who gives 200px shadow?
    There is command margin . 3:25

  • @generationwolves
    @generationwolves 4 роки тому

    I wish I could intern for you.

  • @sumankathet2560
    @sumankathet2560 6 років тому

    1st comment 😂😂

  • @teleleuinbedeleu
    @teleleuinbedeleu 6 років тому

    Awesome