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

Using rem for scaling7:10

And they show you, as a convenience, the pixel-based companions. And once again, if you want to practice your formula, well, the base font size is 16. So we can say 16, in this case, times 1.25 gives us 20. And what do you know? That's the exact value there. But anyways, if all of your text sizing is using rem, that means for mobile layouts, and you want to tweak the sizing, you don't do stuff like this. You instead keep it like you had before, and then tweak your root base font size. So let's go to app.scss, where we are using Tailwind. I will boot up our watcher.

Adjusting root font size7:42

So let's go to app.scss, where we are using Tailwind. I will boot up our watcher. And then, yeah, let's just do it anywhere, right around here. So we'll say, once again, the default font size is 16 pixels. I like to hard code this, even though you can almost always rely on that being the default. Anyways, let's think. If we want 12 to be the base for mobile, well, why don't we set that as a default, and then set up a screen for, let's just switch to large at that point. And there, we can set a font size to a base of 16 pixels. All right, so does that make sense?

Wrapping content in sections10:25

But then when we bring it back down to mobile, you end up with this thing again where the text is once again up against the edges. So as we discussed, this is why it's useful to take every section of your site and wrap it in something called section. Whether that's a div with a class, you can use the section element itself, whatever you want there. In this case, I would get all of that and wrap it within a section there and bring it back. Okay. And you could add a class of section.

Adding section padding10:51

Okay. And you could add a class of section. And now you have a place to say, whenever I apply this class, I need to make sure that I have a padding-left of about 20 pixels and a padding-right of about 20 pixels. If you come back and refresh, now you always have that spacing even for mobile. And of course, you can expand it and you get what you would normally expect. But yeah, this is an important thing. Anytime you have a new section that's not already within a container or something like that, yeah, you might want to follow this convention of wrapping it within a section. All right.

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