02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous Video
Chapter is concluded.Next is

Changing how the cursor looks like

We wrap up this course as we change how the cursor looks like. We completed all the critical CSS properties that are critical for you to become a web developer. Now it's time to practice them. Join our CSS3 hands on course as we continue and learn new things and practice some of the trending hot topics of CSS3. Thanks for joining this course and we hope to see you in %u201CCSS3 Hands on%u201D.

Video Transcript

00:00We reached the end of our title. There's one lecture left in it
00:03We're gonna basically see how to create rollover effects through CSS
00:07And how could we o two change the way our cursor looks like by default by then this lecture really have all the core
00:15Basically, you know all the properties and all the features that are available in CSS for you to start creating amazing projects
00:21There's a few things we did not cover which were mainly tables which are gonna save that for a future title
00:27So I hope you're at a wonderful time and you're ready to start creating amazing things in the next lecture
00:33Which is not gonna be exactly a lecture
00:36What we're gonna do is we're gonna give you a homework assignment and it's time for you to jump into the comments and show us
00:41What you're doing. It's gonna be really really cool. So let's see you right here and I'll see you in the next final final slide
00:49Let's get started finishing the last new thing we're gonna be learning in this course
00:54So let's jump right into it and we're basically gonna be covering a hover effect. And what I really want to do is I want to add
01:02You'll see in our HTML. You'll see that there is a
01:05URL here that we've been doing nothing with it is empty but really
01:09We have an image that we really want to showcase inside of it
01:13So if you go into your source files and just look into your image folder, you'll see that there's an image
01:19Called every that has your a grayed out image and a non grayed out
01:24Image that is a repetition one on top of each other its dimensions are 24 by 60
01:31In other words each item is taking 30 pixels in height with that said, let's jump right into the code
01:37And what I want to do in our CSS
01:39I'm gonna go ahead immediately and I'm gonna start building it out. Then the class name of this area is everything and
01:48What do we want to do to first? We wanted to find a width the width is gonna be 24 pixels
01:54We wanted to find a height that height is going to be 30 pixels as we saw
01:59All right, what else do we need to do here the next thing we want to is load up that background
02:05Where is the background? It's in a URL not our URL URL
02:10Which is located two folders below in the image folder and it's called every dot PNG
02:18We don't want it to repeat
02:21We want it to be on the top left corner of the element
02:25Well, that gives it although technically if we would just position it just the way it is even without anything
02:31We'll see that our item should if we go ahead here and just look at it for a second and click on refresh
02:36We'll see that our item should appear now, but because we set here
02:43Because we set here a masking a clipping
02:45I'm gonna go ahead and just make sure that I get rid of that clipping for a second
02:50and
02:50Let's refresh one more time and we'll see that if we look at our any other item
02:56We'll see that it is getting rendered it is here, but we can't see it. We can't see it
03:01So I'm gonna go ahead and continue and literally define and say I want you to be in your top left corner
03:08and I want to display the item as well and I want that item that natively that initially is not a
03:16If you remember it's just like a span in a tag it basically is part of a line
03:21I want to go to that a tag and I want to tell it by the way
03:25I want you to be a display that is a block
03:28By setting it to be a display that is a block then I will only then see the actual content because then those size
03:34Definitions that I gave would actually come into effect the width and height so far didn't really have an effect so far
03:41But now that I've configured it it does if I go ahead here this time around and I get rid of that spacing of the top
03:48left then
03:50Would it work?
03:52Probably it would release the exact same thing and the reason is is because by default it would go to the top left
03:57So it wasn't really needed. I didn't have to add it or define it. So let me continue
04:03I really want the content in the even though that it's a block. I want it to float
04:07So I'm gonna go ahead and set it to float to the left
04:09Making sure that the content would then float around it and we won't break a line with everything nice
04:16Next thing is I want to make sure that this item is going to be somewhere centered with that everything nice item
04:21So we're gonna push it away a bit. So we're gonna play with our margins. So I'll go ahead here and set a margin
04:27Let's set a margin
04:29Top of a negative value because we want it to be a little bit higher and I want to have a margin
04:35right
04:37About 10 pixels give or take I'm not being incredibly accurate right now
04:42So if I go ahead here and I click on refresh
04:44We'll see that my item is more or less sitting and aligned and now I could go ahead and turn up turn on my clipping
04:51Again, but I would then have to make sure that I'm also making sure that I'm not gonna have the space out
04:57So I might want to play around with the clipping a little bit
04:59So if in this case I might go to my footer and maybe play around with the values just a little bit
05:05Maybe give it a little bit more space on the top. Maybe give it a little bit more space
05:12On all directions really
05:15But mainly on the top and bottom I want to give it a little bit more breathing air
05:19So now that I got those values I could literally just go ahead and copy it and just update my rectangle
05:25All right, so we're almost done but not done yet
05:28The next thing that I want to do is I also want to play around with the rollover state
05:32We haven't seen it yet, but it is incredibly easy
05:35I could just go to my everything and say by the way when someone hovers over you
05:41What do we want to do? We want to go and we want to change our background position
05:46So I literally I could say by the way background position. I want to move you left by minus 30 pixels
05:52By doing so I could literally have your really fantastic effect where if the user rolls over the item
05:59It will move to that bottom image and if not it will move back and that's literally all I had to do now again
06:07When we're talking about that with the left and top of that because my positioning I set it to left
06:11But really what I'm saying is zero minus zero pixels minus 30. That's the position change that I'm doing
06:17Those are the two configurations my my left and my top
06:21So in this case if I just leave it as zero and minus 30 that should work as well
06:25It should do the exact same effect. Okay, so let's continue now that we said that there's one more thing that I really want to do
06:31Is and I really want my cursor to be a question mark because we're a support team
06:35So we want it to be a help cursor and not the regular default cursor to do that
06:41I'm gonna go ahead into my everything and I'm gonna make sure that my everything has a cursor to it and that cursor and
06:49Probably I'd want to put that in the hover state. So I'm gonna go into my cursor
06:53What cursor do I want to have when the user hovers over this item? Well the hurt I want it to be the help cursor
07:00and if I go ahead and I click on refresh now and
07:04Go to that item. You'll see that now we have a question mark whenever the user rolls over it now
07:09This is depending on the browser itself. Now. There's a lot of different options there and I'm just gonna paste in the
07:18Formal documents information that's from the CSS
07:22Documentation and you'll just go play around with it. There's so many different options
07:26They're among them the capability of putting in directly a URL
07:30So this is gonna look a little bit weird
07:31But I want to show it to you now that we're ending this title almost because you might end up going into the formal
07:38Documentation at some point now this structure basically says or you could put inside a URI which is a URL
07:44Just like we've set earlier defining a URL for that rollover state
07:49For example, we might want to set the URL in general for our application our cursor
07:55Whenever we're in the cursor, we would have a cursor that is going to be that URL
08:00if we define that and we set that as our cursor and let me just go ahead there and
08:06We set that as our cursor and let's say I set that all the way in our body
08:10And I go up here all the way on the top
08:12I just say hey by the way
08:13I want the cursor to always be basically this URL
08:16Then if I go ahead and I click on refresh if the browser has that level of support
08:21It would show that URL if that image is not supported or that request is not supported then it's just gonna be ignored in our case
08:29What we really want to do is we want to actually define a cursor that is going to be just that help
08:35But there's if we go back here to those documents, we could do a crosshair
08:38We could do a pointer. We could do a mover. We could do a resize
08:42And Northwest and so on and so forth or a text one a weight one a progress one
08:49There's so many options
08:50So you could control it whenever you want to or give it back to set it back to be the auto
08:55Whenever you don't want to use a bit in general
08:57I would not play around with the cursor
08:59I would keep it with the default values that are available unless you want to just
09:03For example, like in this case make it a help or make it a hand
09:08That would enable it to basically to be a pointer. So it's something that's going to be clicked on and so forth
09:14So there you go
09:15That's it for our title really and then so we'll see in the next lecture
09:19Which will be our last chapter and our last lecture in this title
09:25Learning better is better

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!