Practical CSS Layouts

Tour Page Styles

Jen Kramer

Jen Kramer

Practical CSS Layouts

Check out a free preview of the full Practical CSS Layouts course

The "Tour Page Styles" Lesson is part of the full, Practical CSS Layouts course featured in this preview video. Here's what you'd learn in this lesson:

Jen begins styling the medium design's tour page. A background gradient is added, and text styles are updated. The beginning CodePen for the medium design can be found in chapter four of the course website.


Transcript from the "Tour Page Styles" Lesson

>> Right, so we are done with easy design and we are moving on to our medium design. So we are in Chapter 4, And if you take a look at that website, you will see what we are going to be building for our medium design. And actually we're not gonna start with what is pictured here, we will start with the tour page.

And the tour page, if you scroll down about halfway down the page or so, you will find a picture of the tour page. It looks like this. So we have now added to the tours that we had before. Already had the tours. Obviously, we're adding now a button so that you can buy tickets.

I notice we have some buttons that are sold out, yeah. Other changes that you see there?
>> Gradient.
>> Background gradiant.
>> There's definitely a background gradient. By the way, I apologize for the stripy thing. The way I took a screenshot of this meant the gradient kept redrawing.

So that's why it looks that way. It should be smooth gradient from top to bottom. Any other changes that you see?
>> It has social media.
>> There's social media down here in the footer. So that's something that we're gonna need to build. And anything else that you see?

>> Font.
>> The fonts are different, yeah. So we have some additional fonts that are here in place. So that's the kinda stuff that we're gonna think about here for our tour page. So if you open up, you're starting CodePen. All right, And that starting CodePen, wow, I forgot to put it on there.

So to get to the starting CodePen, click on the CodePen Collection up here on the top. So put you into a table of contents. And on the second page, look for 4a, medium design tour page begin. That is where we're going to start from, okay? So 4a, medium design tour page begin.

I'll add the link for this. Okay, so once we've got that open, make sure you fork that to your account. And so you'll see here what we have. We are starting with basically the stuff that we had on our old site, okay? We've got some new wild and wonderful things here that are coming in.

I have given you a few things I was gonna talk about in a little bit more detail, just to sort of move the course along a little bit. So let's just look at the markup here and see what we've got. So at the beginning, we have a wrapper here and I put a note at the top.

Eventually, we need to add some top navigation, we will add that later. We have a wrapper around the whole thing. We have the header with the logojust like we had before, nothing to change there. We have our main focus of the site, that's our tour, we have our individual dates.

But now, in addition to that date information, we have an a and sometimes they have one class and sometimes they have two button-primary button-sold out. Make sense? Okay, and so that's goes down here through the main part of the page. Down here in the footer, I've got some SVGs down here that are for the social media, they are inside of a link that go to SoundCloud, Spotify, and Instagram.

Make sense? Okay, so always good to take a look at your HTML before you start so you understand what you're working with. All right, so let's start making some changes here to our CSS. So since we're working on the tour page, where we're gonna start is we can get rid of this layer here for reviews, which just doesn't apply to this particular page.

And to keep our CSS down, you can just get rid of the layer for reviews. The media queries that are here, we can get rid of those as well. We actually don't want it to do the designs that we had for the easy page, right, where it goes to this wild and wacky thing here.

So it doesn't work on this page. So let's get rid of that. So inside of our media query for the main width of 800 pixels, we can get rid of main, main h1, and aside. So basically, the only thing that we're keeping there in that media query is our wrapper with.

Likewise in the larger media query, get rid of main. So when you're done, it should look like this. You should have base, header banner tour. You should have the media query with just the wrappers in it, okay? I'll give you a second. Everybody good? Okay, so let's focus on these buttons here to start with.

So you'll see here, I have a button, it's a link currently. It says, Sold Out, okay? And this one says, Sold Out. And then down here, I have Buy Tickets. That one's actually underlined, everybody see that? Okay, let's look in the HTML at how those are looking. So I am up around line number 13.

So here, we have a paragraph, inside of that we have a link. It says, a class button-primary button-soldout. What is missing from that element?
>> A button.
>> Href.
>> There's an href missing, right? There's no actual href in there, there is nothing. When this button is clicked, it doesn't go anywhere.

How cool is that? This is the easiest way if you wanna have a button that ultimately when you mouse over it, nothing happens, it looks like that Sold Out button. This is the easiest way to code it. It goes nowhere, all right? Why didn't I use the button element here?

Why did I use a instead of button? Anyone have any comment on that? Do we have any idea why I would ever do such a thing?
>> Cuz it's a link that goes to an external website.
>> It is a link. It actually doesn't matter if it goes to an external website.

This is a link. Obviously, it probably would go to an external website, right, where you go buy your tickets. It's not a button. What are buttons used for? The actual HTML button, what is that used for?
>> Interpage, or sorry, same page interaction, or form submission.
>> Form submission, yes, that's one thing.

Anything that has to do with JavaScript, okay? So some kind of functionality is happening, basically anything that's not a link. So if you wanna have a button, it looks like a button, but it's going somewhere else, you code it like a link, and then you style it to look like a button.

Make sense? A link is a link, people. A link is a link. We will die on this hill, all right? So that's what's going on for those sold out ones. They have a class, but they have no href, that's gonna help us make a Sold Out button. But notice that we still have a hover state, look at that.

That's because links have hover states. So somehow we're gonna have to disable that, yeah. Down here, we have a hover state too, but that when we actually want, because I mean ultimately that would go somewhere, right? Okay, and those are just the button primary by itself. So let's go through and set up some styling for these then.

And so, Here's what I'm gonna do. Currently, we have a layer that's called header-banner-tour. Let's turn off the part of that. Let's rename that layer to just header and banner, okay? And then down here, we have date and club. Date and club, remember, apply to this tour section.

So I'm going to end my layer here on line 136. So that'll just be header and banner, those styles. And then for date and club, we'll set up a new layer, layer tour. And there's the date in the club inside of that. Some other changes we're gonna need to make.

If we go to our base styling here, right now on our body, we have a text-align center; that's set. In this medium design, we don't need that. So you can get rid of the text-align center on the body. And in our variables up here, we have a font variable here for sans-serif.

We will have two more variables. I've already set up this CodePen to link to the Google fonts, we don't have to go through that whole process again. So you'll just trust me that it was done correctly. We're gonna have a serif font, and I'm gonna call this Cormorant Garamond, serif;.

And I'm gonna add what's called cursive and that one is Pacifico, cursive;. So those are the three fonts that we're working with so we can configure those variables. And then, of course, if you were working in real life, you would add your Google font links to those fonts and in CodePen.

You would put it in the right place in CodePen. I've already done that for you. One of the other nice things that we have is we have a lovely gradient background to this page, instead of having the solid teal color that we have now. And there are lots of websites if you Google for CSS gradient.

I believe one is where you can just go and create these gradients, so I had done that for you. And, Hopefully, this is relatively straightforward to type in. But anyway, if it's not, you can always go to the ending CodePen and copy it. All right, this is our gradient.

It's gonna be the name of our variable, cuz it is. It's gonna be a linear gradient. And into that, we're gonna say 180deg, var(--black). So it's gonna go from black starting at 0%, and it will go to var, oops, there's a comma, 0%, var(--teal). It's gonna go to teal at 100%.

This is a pretty straightforward gradient. So normally, it would go from teal to black, where the 180 switches it around, so black's on the top, teal's on the bottom. And so that it will set up the gradient, its here on the page. So just cuz you have a variable doesn't mean it applies, right?

Where do I apply this?
>> Body.
>> Body.
>> On the body element, exactly. So instead of background color of our teal, we can change that to var (--gradient), see if that works. And it doesn't work, why doesn't it work? First rule of CSS, don't freak out. What's wrong?

Says background color, doesn't it? This isn't a color, we just say background Okay, so gradients are different than colors, don't freak. [LAUGH] Nice? Okay, much better, pops off the page a little bit better than that teal by itself. All right, sweet, and you can see it stretches all the way down the page, isn't that nice?

>> I think you need quote around Pacifico on cursive.
>> Yeah, thank you, Pacifico. Okay,

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now