02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Setting our first style

We start our journey into the world of CSS with our first live example of defining some style to our HTML document using the HTML style property.

Video Transcript

00:00We start our journey into the world of CSS
00:03with a few first live examples
00:06where we'll define some styles
00:08directly inside of our HTML document
00:10using the HTML style property.
00:13So let's jump right into it and see how that's done.
00:16All right, so what I wanna do next
00:18is I wanna show you how to create a CSS property.
00:21And literally all you wanna do
00:23is go to any HTML element.
00:25For example, any visual element probably.
00:28And I wanna go, for example, to my body.
00:30All I have to do is type the word style
00:33and then define whatever property I want.
00:35Then there are many HTML CSS style properties.
00:39You just have to get familiar with them.
00:41And throughout this course,
00:42we're gonna familiarize ourselves with them.
00:44But our main focus is gonna be on the integration
00:47and the overall overarching planning and building CSS,
00:51which is the more complicated part of the language.
00:54But the language itself is very easy.
00:56For example, background color with a minus there.
01:01Notice if you know JavaScript,
01:03that minus in JavaScript is forbidden to use for properties.
01:07But in the case of CSS,
01:08a property is spaced out with a minus.
01:12Next step is I put here a colon,
01:16or I go ahead and put there a colon
01:18after the name of the property.
01:20And the next thing is I define the color itself.
01:23Now, in CSS, the common way to define colors,
01:26there are other ways, is using a hexademesal value.
01:30Now, the way it works is very simple.
01:32You put a hashtag,
01:33and then you define your red, green, and blue.
01:38Now, the values look a little bit weird,
01:40but the values range from zero, zero, all the way to FF.
01:46Now, the reason is because hexademesal values
01:48are basically when a digit could represent
01:51up to 15 characters.
01:53So it goes from zero, one, two, three, four, five,
01:55six, seven, eight, nine, and then it goes to A, B, C, D, E, F.
01:59Now, the totality of variations that are possible
02:02are 255 variations that will define our color gamut
02:08of our blue, our red, green, and blue.
02:12And the combination of them is about
02:14millions of values of possibilities
02:16because it's 255 times 255 times 255.
02:20So if I go ahead and just open up a calculator
02:23really quickly, that would basically mean
02:25that the combination of colors possible
02:27within those six digits are way over a million, right?
02:31So this is one, two, three, one, two, three.
02:33So there's over 16 and a half million colors.
02:35And that's where, by the way,
02:36you hear a lot of times about screens
02:38that have 16 bits or 32 bits.
02:41It really goes down to how many millions of colors
02:43could they show.
02:44In this case, the range that we're talking about here
02:47is that range of colors of combinations
02:51between red, green, and blue.
02:52Now, in my case, we're not gonna go ahead
02:54and we're not gonna talk about too much of color history.
02:56I'm just gonna go ahead and go and just define the color
03:00because I already have that pre-configured.
03:03So I'm gonna go ahead, you're in writer F, D,
03:0681, and then 3B.
03:09And I'm gonna go ahead and save it,
03:11go back into my browser and click on refresh
03:14and you're gonna notice now
03:15that I'm gonna get this beautiful orange
03:17as my background to my application.
03:20Now, on a side note, a very, very useful tool
03:22if you're working with Firefox as well as your browser
03:26is this tool that is called Colorzilla.
03:28Just Google it and download it
03:30and add it as an extension to your browser.
03:34Once you have the color picker,
03:35you could literally go to any area on your HTML
03:38and literally just copy it to my clipboard.
03:42So once I copied the color into my clipboard,
03:44I could go ahead and just paste that color directly
03:47into my CSS, making life really, really easy.
03:51And this is a really great way for you
03:52to figure out colors for your HTML page.
03:55Another great comment is,
03:57take a picture of something beautiful in nature
03:59and then go ahead and use this tool.
04:01Just drop it into a browser
04:03and use this tool to grab the colors
04:05to create the color gamut of your application.
04:08So you don't have to be a professional designer
04:10to find these really nice color combinations.
04:13So that's a really good advice,
04:14a good tip of coming up with colors on your own.
04:17There's also sites that give you great color combinations
04:20such as cooler, but we're gonna talk about color
04:23that this is really our foray into CSS.
04:26This is the first property that we see in CSS
04:29and the way we wrap a property
04:30is by putting a semicolon after it.
04:33So again, we define the property, we put a colon,
04:36we define the value of that property.
04:38In this case, we're putting a color,
04:40a hexadamestle value.
04:41So we start it with a hashtag and then the color itself
04:44and we end it with a semicolon.
04:47So let's see you in the next lesson
04:48when we continue talking about CSS properties.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!