Inspecting any CSS on the fly
We wrap up this chapter as we take a look at how to peak at other sites code. One of the most common thing HTML/CSS developers do is peak at wonderful samples they like online and learn from them. In the end of this lesson you will know how to tweak CSS rules of your own or even peak and grab ideas from other sites.
Video Transcript
00:00Although, throughout this training, you're going to learn a lot of CSS, but one of the
00:04powerful things you could do as a developer is continuing learning on your own.
00:09So when you see something really cool, a CSS and HTML page that just looks interesting
00:13and you don't know how to do it, I want you to learn how to find out how to do it.
00:17And that is the title of, this is the topic of this lecture, the last one in this chapter.
00:22So let's jump right into it.
00:24I want to continue where we left off, but also learn a few more new things.
00:28We're going to go ahead and continue and getting our application to be closer to that final
00:33outcome that we've seen in the intro of the course.
00:38To do that, I'm going to go back into my CSS style property area.
00:42And what I want to do is I want to define a rule for our H2, our actually H1 and O2H3.
00:49Now if you're wondering why H3 is because that is defined inside of our JavaScript here,
00:55where we have a style definition, but really, you know, let me actually show you something
01:02even better.
01:03I want to show you how could you on the fly decide what size do you want your HTML elements
01:09to be?
01:10Now, if you took our HTML course, then you know that you could right click inside of
01:15Firefox or any other modern browser and find something similar to inspect element.
01:22When you do that, you're going to be opened up to a panel that most of the time will enable
01:26you also to do stuff to it.
01:28So for example, in this case, I could go ahead and just dynamically check out, for example,
01:33just type your font, because I know there is a property that is called font size.
01:39And I'll see I have your font size.
01:41And then I could go ahead there and define what size do I want that font to be.
01:45Now I would love this 45.
01:48But if I wanted to, I could have played around with the values, found the value that I want
01:52it to be, and then continue on to configuring our application.
01:56Now, in this case, what I really want to do is I want to define a font size.
02:01So I'm going to go ahead and I want to set every h1 element, I want your font size
02:05to be that 45 pixels that I know that I like, again, I don't need a semicolon.
02:11But I could go ahead here and just copy this rule.
02:13And again, I'm going to also get rid of any extra spacing I have here, because that's
02:17just wasted space that is being saved and sent to the user.
02:21I'm going to go ahead here for my h2.
02:23And I'll define an h2 of let's say of 30 pixels.
02:27And I'll go ahead and create an h3.
02:29And I'll create a font size for that as well.
02:31Set that to be 25 pixels.
02:34Go ahead and save this.
02:36Notice, by the way, this rule that I added in is only temporarily there, only visible
02:41to me because I'm modifying it on the fly.
02:44You could do this to any website.
02:46You could peek at it and see what are the CSS rules, and you could change them on the
02:49fly.
02:50But you're not really changing it to the live site.
02:52You're just changing it in a virtual environment on your own system.
02:56If I go ahead and click on refresh, we'll see that now our CSS rules have been applied.
03:01So if I go ahead and inspect this element, I'll see that it has an h2 rule of 30 pixels.
03:07And if I go to this element and inspect it, I'll see it has an h1 rule of 45.
03:14So there you go, the basics of how could you test out and play around and figure out how
03:19do you want to modify?
03:21How do you want to control an element?
03:23Literally you could just go ahead to that specific element, inspect it, and then start playing
03:27around with it until you're happy with the results.
03:30And then you could go back into your code and add those results that you added in.
03:34And obviously, you could use this also to peek at live sites that you like something
03:38that they're doing to discover how they did it in CSS.
03:42So that's it for this topic and that's it for this chapter where we wrap up the basics
03:47of working with CSS.
03:49But don't worry, there's a lot more to talk about as we move on to chapter two.
03:53So we'll see you in chapter two.
03:55Now in the meantime, I encourage you to play around with the rules that you've learned
03:59so far and discover on your own properties that you could change because the basics
04:03of the rules of the laws of the way that the language works are in your hands already.
04:07You could start creating now really interesting projects.
04:10Find the different scripts, find the different properties, and you could start working.
04:14As we progress throughout the chapters, we're going to learn about more sophisticated CSS
04:18as we travel through all the critical properties that you want to be familiar with.
04:22So we'll see you in the next chapter.
04:24And thanks for checking and being with us in this first one.
