تماشای این درس نیاز به اشتراک حرفه‌ای دارد.

Setting Up Banner0:00

Next up is CSS clip paths and masking, which can always be a little bit confusing. So I'm going to pull in Tailwind for some quick styling, and we will set up the mask for a typical homepage banner, much like you see at LayerCasts. So I'll say, hello world, and then we'll set maybe a background of blue, let's hard code a minimum height just to simulate some content, and let's have a look. We give it a run, and that's what we get. So lastly, let's put hello world smack dab in the middle of the banner. A really easy way to do this with modern CSS is to set a display of grid, and then use the place items property and set it to center. Give it a run, and now you have perfect vertical and horizontal centering. And it only took two properties. All right, so now maybe you want a rounded border, very similar to what you'd see at LayerCasts here. Notice how that's rounded.

Restoring Rounded Edge6:38

But now notice, as part of that, we've lost that nice rounded edge there. So yet again, like background images, we could do the position. So if I want to put it at the bottom, you can see I do bring back that rounded edge there. And this is what we get. Very similar to Laracasts. So let's do this. Let's go ahead and we'll store it right up here. We'll call this our banner, and I'll paste it in like so. And then finally, let's give it a class of banner. All right, come on back, and that should be saved, and it is.

Adding SVG Mask Image8:06

So if I had, let's see, let's add an image here. And just to be a little meta, I have an actual mask SVG, protectivemask.svg. Let's have a look there. Okay, it's gigantic. Class width is 20, something like that. Okay, so now imagine you wanted to place this maybe overlapping the edges here. This is something to be careful of. You can't do that. Let's set style to bottom is negative, I don't know, 40 pixels,

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟