Bummer! This is just a preview. You need to be signed in with a Pro account to view the entire video.
Start a free Basic trial
to watch this video
In this video, we'll work on the third and final column in our layout. This column will contain our large call to action button, along with some testimonial quotes about the mobile web app we're advertising.
-
0:00
]Master Class Fluid Grids] [CSS: Part 3]
-
0:05
We're done with the first 2 columns, but now, it's time to move on to the third one.
-
0:11
This last column will contain our call to action button and
-
0:14
our testimonial quotes about the app.
-
0:18
So let's go ahead and switch back to TextMate and continue.
-
0:22
We're going to go ahead and create a new comment flag so that we can
-
0:27
sort of start a new section here, and we'll make some room to work, and we're going to call
-
0:34
this section "Call to Action" because we have quite a bit of styling that we want to go ahead
-
0:42
and apply to our call to action button because we're going to create a button out of css 3.
-
0:50
So we're going to go ahead and select it.
-
0:54
It's in the miscellaneous column and remember, the div is named call to action,
-
1:01
and this button is actually just going to be a link, but there's a lot of things we need to
-
1:07
do to go ahead and style this.
-
1:09
First, we're going to go ahead and start out with the color.
-
1:13
We want this to be white because it's going to be
-
1:16
set against sort of a darker colored background.
-
1:19
We'll set the font weight to bold.
-
1:22
We'll set the text decoration to none.
-
1:27
We'll set the display to block because links are of course in line by default.
-
1:33
We'll set the margin to 100% on the top, auto on the left and right and 30 pixels
-
1:41
on the bottom just to sort of space it out.
-
1:44
We want the text inside of our button to be aligned center, and we'll put some
-
1:51
padding around the text so the text isn't actually touching the borders of the button.
-
1:57
We'll set the font size manually using 1.7 ems, and we'll scroll down a bit here.
-
2:05
We'll set a border radius using webkit border radius, and
-
2:12
we want a nice big border radius of 30 pixels.
-
2:15
We'll go ahead and copy that and paste it in and do the same for Mozilla,
-
2:22
and then finally, we want just the default without any sort of vendor prefix,
-
2:28
and then we're going to set a box shadow on this, so we'll say -webkit-box-shadow.
-
2:35
We want the x offset to be zero,
-
2:38
the y offset to be one, and the blur radius to be one, and we do want this to be an actual
-
2:45
shadow so we'll set it to black.
-
2:48
We'll go ahead and copy that and change the vendor prefix for Mozilla, and then
-
2:55
we'll paste it in one more time and remove the vendor prefix entirely.
-
3:01
And now, we're going to repeat this pattern one more time for the text shadow.
-
3:05
So we'll go ahead and say -webkit-text-shadow, and we want to sort of create an
-
3:12
indented text effect, or make the text look like it's pressed into the button.
-
3:17
So we'll set the x offset to zero pixels, the y offset to negative one pixels so that the
-
3:24
so that the shadow actually appears above the text.
-
3:27
We'll set the blur radius to one pixel just to sort of make it blend into the button,
-
3:33
and then we'll go ahead and set the shadow color to black.
-
3:38
Now remember, our text color is white here, so we're putting a black shadow just above
-
3:44
the text, and again, that will make the text look like it's pressed into the button because
-
3:50
the black shadow will actually look like an inner shadow.
-
3:54
So we'll go ahead and copy this and change the vendor prefix to Mozilla, and then we'll
-
4:01
paste it in one more time and remove the vendor prefix entirely.
-
4:06
So let's go ahead and save that out, and we'll switch over to Google Chrome and
-
4:11
refresh the page, and we want to watch this "start taking notes button"
-
4:16
so we'll refresh, and now we have a pretty good looking button,
-
4:20
but we still need to apply a background color.
-
4:23
Now to do that we're going to apply a gradient.
-
4:26
So let's go ahead and switch over to TextMate and first, we'll go ahead and do the
-
4:33
Mozilla styling, and we're going to actually put a noise png on top of our gradient.
-
4:41
Applying just a little bit of noise will give our gradient some variation and
-
4:46
remove any artifacts from color banding.
-
4:48
So we'll go ahead and set the url for that.
-
4:53
We'll jump outside of our css directory, go into the images directory, and the image we want
-
5:00
is called "noise.png."
-
5:03
We're going to be using multiple backgrounds here, so we want to put a comma there, and
-
5:08
our next background is going to be "Mozilla linear gradient",
-
5:15
and we want to set that to top, and I have a very specific green color picked out
-
5:21
from our Photoshop document, so I'll just go ahead and type that in.
-
5:24
It's "46D06C" and we'll set that to 0% so that will start from the top, and then I have sort of a
-
5:36
darker green color and that will work us down to the bottom.
-
5:43
So we'll set that to 100%, and then we'll go ahead and copy this, paste it onto the next
-
5:51
line and now we're going to do the webkit styling, and of course, we can't just simply
-
5:55
change the vendor prefix because the gradient syntax in webkit is different.
-
6:00
So we're going to delete all this but keep our noise png.
-
6:05
We'll say "-webkit-gradient."
-
6:09
We want the type of gradient to be linear.
-
6:12
We'll set it to left top and work our way down to left bottom.
-
6:18
The first color stop will be 0%, and we want to use that same green color that we started out
-
6:27
with so I'll just go ahead and copy and paste that and then our next color stop
-
6:35
will be 100%, and we want to use that same darker green color.
-
6:41
So I'll go ahead and copy and paste that, just like that, and as a fall back I'm just going to go
-
6:48
ahead and say "background-color" and set it to that same dark green color.
-
6:54
So I'll copy that and paste it.
-
6:57
And of course, that will just be for browsers that may not support css 3 gradients.
-
7:02
So let's go ahead and switch over to Google Chrome and refresh the page, and
-
7:07
you can see that button is starting to look pretty nice.
-
7:10
Now we need to create a hover state for that button.
-
7:13
So let's go ahead and switch back to TextMate and scroll down here,
-
7:18
and we'll go ahead and select that button again.
-
7:22
So we'll say miscellaneous for the column, and the button is of course called "call_to_action",
-
7:29
and we want to use the hover pseudo class, and for this we want to use a very similar
-
7:39
background to the one we had before, and we want to change this color to a lighter
-
7:46
colored green, so we'll say "46FF6C" and for this next color we'll say "46D06C",
-
8:02
and we want to do the same thing for webkit, so we'll go ahead and copy what we have here,
-
8:10
and then we'll just paste in these new colors.
-
8:13
So there's our first one and there's our second one, and then of course we do need a
-
8:21
fall back for browsers that don't support gradients, so we'll just say "background-color",
-
8:27
and we'll set it to this lighter color here.
-
8:31
So now when we switch back to Google Chrome and refresh the page, we can go
-
8:36
ahead and hover over our button and you can see that when we hover over it, it highlights
-
8:41
and goes to a lighter colored green.
-
8:44
So that's pretty nice.
-
8:46
You can go ahead and switch back to TextMate now, and
-
8:49
we'll go ahead and move onto the next section.
-
8:52
So the next thing we want to style is our quotes, or testimonials.
-
8:57
So we'll copy a comment flag and paste it in there, and we're going to call this section
-
9:04
"Quotes" and these quotes appear just below our call to action button.
-
9:10
So we'll go ahead and select our column miscellaneous, and these are block quotes
-
9:17
so we're just going to select the element "blockquote", and the first thing I'm
-
9:24
going to style is the font family.
-
9:27
So I'm going to go ahead and type "font-family", and I actually want to use a special font here.
-
9:33
I want to use the same Pacifico font that we used for our logo, and to do that,
-
9:40
we need to visit the Google font api, which you can check out at google.com/webfonts.
-
9:47
So I'm just going to go ahead and find on the page here Pacifico.
-
9:53
There it is.
-
9:55
And I'm going to say "use this font" and all I need to do
-
10:00
is copy this style sheet into our html document.
-
10:08
So I'll switch over to our html here, and we want to put this above all of our style sheets so
-
10:13
I'll go ahead and put this above application.css.
-
10:17
So I'll paste that in there, and now we're ready to go ahead
-
10:21
and use that font in our css document.
-
10:25
So it's called "Pacifico" and then we'll have a few fall backs such as "arial"
-
10:34
and just a "serif" font.
-
10:37
The font size is going to be set manually to 1.6 ems.
-
10:43
The line height will be 1.8 ems, and the margin bottom will be 24 pixels.
-
10:51
Now these values are fairly large, but I want this font to be pretty large and have some nice
-
10:57
separation from the elements around it.
-
11:00
So next we're going to go ahead and style the div that is inside of our block quote.
-
11:06
Let's switch back to our markup just so we can see what's going on here.
-
11:10
I'll go ahead and scroll down to the miscellaneous column, and here we have
-
11:15
a block quote, and inside of the block quote we have some text which is the actual quote.
-
11:21
Nested inside of our block quote we also have a div which contains the name of the
-
11:26
person that the quote is attributed to.
-
11:29
So we're going to go ahead and style that now and go ahead and switch over to our css,
-
11:34
and we'll go ahead and select the miscellaneous column, the block
-
11:40
quote and then the div inside of the block quote, and we'll scroll down here and the font family
-
11:47
I want to be different from the quote just so you can tell that the person's name is
-
11:53
actually different from the quote.
-
11:55
I'll set that to Helvetica which is of course our default font, but we've already set
-
12:00
this font to Pacifico so we need to override that cascading style, and we'll set our
-
12:06
fall backs to arial and sarif.
-
12:09
We'll set the font weight to bold just so it stands out.
-
12:14
We want the font size to be significantly smaller than the quote, so we'll say 0.7 ems
-
12:22
and we want a little bit of margin left on this, and then we'll set the color to
-
12:30
sort of a lighter gray color just so it doesn't detract from the quote.
-
12:36
So let's go ahead and switch over to Google Chrome, and we'll close the fonts here
-
12:41
because we don't need that anymore and we can refresh our page.
-
12:45
And now, you can see that we have this nice Pacifico font on our quotes, and then we
-
12:51
have the name of the person that that quote is attributed to right below it.
-
12:56
So that looks pretty good.
You need to sign up for Treehouse in order to download course files.
Sign up