Placeholder Image

字幕表 動画を再生する

  • Hello, everyone Today is gonna be a special video because we're jumping all the way back to the roots of Web have simplified and making an HTML and CSS design, which is gonna be for a price comparison table.

  • And now this is a bit of a special design because I posted my original design on Twitter and I said, Hey, give me any suggestions I can to improve this.

  • I'm gonna make it story on it tomorrow.

  • And quite a few people suggested changes, and then one person in particular posted an entire mock up a redesign of it, and it looks amazing.

  • So I went through, made all the changes that are design is gonna look just like this mock up and it's gonna be incredibly fun to do, so I can't wait to get started now way.

  • Welcome back to Webb has simplified my name's Kyle, and my job is to simplify the web for you so you can start building your dream project sooner.

  • So that sounds interesting.

  • Make sure you subscribe to my channel for more videos just like this one.

  • And he had started, As you can see on the right hand side here I have the incredible design that was supplied to me over Twitter for this price comparison table and on the left, I have a visual studio code project which just has to spg icons which you confined in the get have repo left in the description.

  • Or you can go to feather icons, which is where I got these icons from now to get started, we obviously need to create an index dot html file and we could just put exclamation point to initialize it with all the default values that we're going to need.

  • Now we can just title this as price comparison table just like that.

  • And now inside of the body, we need to get started by creating the main section for all over content to come inside of.

  • So it's just creative section.

  • I'm gonna call it here a class of price comparison because there's gonna be holding our price comparison.

  • You can imagine this is gonna be a section inside of a larger Web application because obviously, just the price application on its own is not very useful now.

  • Next thing we need to do is create these columns because this price comparison is going to contain our three columns.

  • So it's create these were just gonna make them gives.

  • And we're gonna call them Price column just like that.

  • So now we have a div with the class of Price column.

  • You can imagine this left side if here, if I zoom in, this is going to be our main price column we're gonna work on.

  • And as you can see inside this price column, we have our heading section, which is going to be this dollar sign text month, the name of the plan.

  • And then we have a divider.

  • This really light, faint line here you can barely see.

  • It's a lot more visible in this purple and then below that, all of our futures and our button.

  • So inside here, the first thing that we need to do is you want to create our price header on this price header is going to contain all of that top information that I talked about.

  • So it's gonna have this dollar sign and all of this numbers.

  • So the first thing we're gonna have is our price section, and this is going to be this very top three numbers appear this number dollar sign and the month So inside of here we can just have a dollar sign instead of here.

  • Obviously, we just put our dollar sign.

  • The next thing we're gonna have is our number, which in our case is 10.

  • And then lastly, we're gonna have the per month.

  • And this is just gonna have slush and O, as you can see here now, if we say that and we open up of life server, you're gonna be greeted with a very ugly rendition.

  • Never go.

  • We have this so far, but this is just the HTML.

  • We're just trying to get this show of our content out before we actually start implementing all of the CSS.

  • Now, the reason that I put this price section inside of its own div is that we can put it all on the same line and civic and properly style.

  • Everything inside of here toe look similar.

  • But outside of that Dave, while still inside of our price header, the next thing we need to do is have the burning for the plan.

  • I'm sorry.

  • Plan, name and the plane name for this one is just kind of basic.

  • Just like that.

  • And Now this section right here is going to comprise all of our price header information and before we start moving on all the features and the button, I think we should start with CSS for this and try to break it down piece by piece.

  • So let's create that styles Nazi SS right here.

  • We want to make sure that we include that source here.

  • So link and we'll do styles Nazi SS just like that.

  • One other thing to note is we're actually using to Google fonts for this application.

  • We're using Lotto and Poppins.

  • If you go to the Google Funds website and add Poppins and Lotto font, you can just copy this exact code right here.

  • They'll give it to you on their website and just paste it in.

  • And then you'll have access to both of these farms for us to use inside of our CSS.

  • Over here and now, the very first thing I like to do in every single project that I'm working on is to make sure I set the before the after and the all content selector tohave box sizing flips box sizing of border box.

  • This just makes styling, wits and heights of elements so much easier.

  • The next thing I want to do is actually we're very lucky and had this nice design guide over here telling us all of the different parts of our application.

  • So I want to set up some variables for all of these design elements.

  • Very first thing is our accent color, so we can create a variable called accent color.

  • And we just want to set that here.

  • 2641 b f f.

  • Just like that.

  • Next thing, there's a dark color we don't really need to worry about.

  • It's just black.

  • That's easy to remember.

  • This border of light color is only used in one place.

  • We don't need a variable saying with his background color, but our fonts over here are used in multiple places, so we can have here a heading funds family, and this heading fund family is going to be Poppins, and we're also going to have here a fallback of Sands.

  • Serif hopes to serve now, as you see over here, says the body found, is SF Pro.

  • I ended up going with Lotto because it's on Google funds, so it's a lot easier to use So we're gonna create a body front family, which is going to be blotto.

  • What about two?

  • And of course, it's going to have a fallback, which is going to be Sand Saref.

  • Now, if we jump over back to our design right here, we can see exactly what we need to do and the first thing we want to do a style, our body.

  • So if we just select our body here, the first thing I wanna do is remove any margin and we have on the body.

  • And we also want to set the background color to this nice, faded background color.

  • And if we look here, we have this background color right here, so we can just say that's f ate half nine f b.

  • And if we save that and go back over here, you see, we have that very faint darkish back on course is very faint off white.

  • How we could go back and start looking at this again.

  • And if I zoom out, you'll notice over content is centered inside the page, which is something that I want to do as well.

  • So we can really easily do that by setting the men with the 100 view with the men height, toe, 100 view height.

  • This means the body will take up the full height and width of our page.

  • Then we can set the display here to flex.

  • We can set the justify content to center and the alliance items into the center.

  • And now, if we look back over here, you see, our content is going to be in the dead center of our page.

  • Lastly, all we have left to do is to set our fund family.

  • And we want to make sure that's our body find family.

  • And if we do that, you can immediately.

  • Sarah fund has changed, and it just looks a little bit nicer.

  • Now, in order to continue styling to make this all look good, we need to make sure that we actually have three different price columns.

  • So I'm gonna copy this price.

  • Kahlan, haste it down.

  • So we have another one and pay Sit down.

  • So we have one more and let's look back at what the numbers are gonna be.

  • So this last one is gonna be 50 and this is for enterprise, and this middle tier one is gonna be 20 and it's just hopes pro freshen l just like that.

  • Now, as you can see, we have all of our different text on the screen.

  • Obviously, it looks terrible, but we have this price comparison class that we can use that's wrapping our columns toe, actually lay them out side by side so we can select that price comparison and we can change it to display flex, and immediately are contents gonna be lined up side by side.

  • Next, we could just say that we again want this to be in the center so we'll say justify content center.

  • But this time we're gonna align our items stretch, and this is gonna make it so that our items are actually going to stretch to fill the same height.

  • So if one of these is shorter than the other one, they're all stretch out to be the exact same height of each other.

  • Also, we're gonna set here a wit of 100% and we're also gonna just give a little bit of margin around the sides of one r e m.

  • And there we go.

  • That's all we need to do for a price comparison and a lot of these changes we're gonna come into effect were started styling our price calling.

  • And if you remember right, that is the class that we gave to essentially all the content in each one of these columns.

  • This is where we're gonna define our background colors, our border radius, all of our spacing.

  • And the first thing that we can do is we can set the background color toe.

  • Wait.

  • Because as you remember, over here, we have a background color of white around this far left one, and we're focusing mostly on this left side because this is going to be our default price column layout.

  • The next thing we need to do is set up the little bit of shadow that you see around the boxes.

  • We can do that using box shadow and actually, just copy paste to this directly from you think machine.

  • Essentially, we have zero outward movement of this.

  • It's just based around the center.

  • And then we have a little bit of Blair, a little bit of spread, and this is really faint, dark ish color.

  • It's mostly transparent, so you won't really see it too much.

  • But if we look over here, you can see there's just a little bit of a border around here, a little bit of a box shadow that you can see around these elements.

  • It's nothing too harsh, but it's just there.

  • The next thing we need to do is start setting up our spacing and allowing these elements to go away from each other, because right now they're just so pressed up against each other on we can do that by setting, Colluded with Patty will say to R E M we're gonna have a nice large amount of space between them.

  • And already you see there started be padded around for each other.

  • Next thing you can do is working on a little bit of our fucks box stuff so we can say flex agro is gonna be one, and they'll actually grow to be upwards of their maximum size.

  • And in our case, we're going to set a max with of 275 pixels now, lastly so that all of these elements are the exact same size.

  • We can set the flex a basis to zero.

  • Now that should help make our elements all a similar size to each other.

  • Lastly, we're gonna set just a little bit of a border radius around these just to give them a little bit of a pop from the page.

  • So it's a border radius and eight pixels.

  • It also helps our box shadow show a little bit more around these corners.

  • If you remember from our design, though, this middle section is purple.

  • So in order to make that middle section purple, let's change this price calm at another class and we'll just call it popular because this is our most popular design.

  • So what we're gonna do is inside of here.

  • We can say dot price column got popular, and then we can define different styles, for example, or background color is going to be our accent color.

  • Now, if we say that you can see our background color has turned to that purple.

  • Also, our color inside of here is going to be white.

  • Since all of our context inside of here is gonna be white.

  • Text makes it easier to read.

  • But one thing you will notice is that there's rounded corners on the left and right hand side of these price columns, and it just looks a little bit weird.

  • We want to make it so that they but right up into this $20 a month professional section.

  • So to do that, we could just say price column, first, child.

  • Now we're gonna do this.

  • First child is this one.

  • We wantto make the border radius on these border suicide border top right radius, where you're gonna set that to zero.

  • That'll make it so this corner is no longer rounded.

  • And if we save that, you'll see that corner is now a quick 90 degree angle, and we'll do the exact same thing with the bottom, right?

  • Also, we're gonna make sure that we do this exact same thing, but with the last child, which is gonna be the right hand side one.

  • So we'll say last child.

  • Except for this time it's going to be the left and the left, just like that.

  • Now, these borders are completely perpendicular, and we can even see that a little bit more if we change our background color of our body So black.

  • You see, what we've done is we've just made these 90 degree corners over here so that they bought right up against this.

  • When we increase the size of this middle section.

  • Let's put that back to its original color just like that.

  • Now, if we go back to our popular design down here, we have a few more changes that we need to make in order to make it pop out from all the other ones.

  • The first thing is, we want to do a slightly different box shadow.

  • So we're again.

  • I'm just going to copy this straight from the design.

  • Do notice this the same box shadow properties up here.

  • It just has a slightly darker color to it with this slightly more opaque.

  • And if we say that it just was a little bit darker box shut up.

  • It'll make it pop a little bit more from the page.

  • Also, the next thing we're gonna do is we want to make it so that this expands past the other designs.

  • As you can see here, we wanted to expand above and below and a really easy trick to do this is to use negative margins.

  • So we'll say margin top.

  • I will just set it to negative 1.5 r e m.

  • Just like that and you'll see it expands upwards, but you'll notice the text also expands upward with it.

  • So we want to do is we're gonna set the padding on the top 21.5 R e m higher than all over other ones.

  • You noticed these ones have to r E m.

  • So if we set this to 3.5 r e m now our text is exactly where it would be.

  • If we didn't have this negative margin at all, we could do the exact same thing.

  • But for bottom, so it's a margin bottom of 1.5 are Ian and padding bottom of 3.5 r e m again accounting for this too right here and, of course, didn't quite move the way we wanted to.

  • And that's because this should be a negative 1.5 R e m.

  • And now, if I say that, you see it expands about the top and the bottom and again if I change this color to black, so it's a little bit easier to see.

  • You can see very clear that this is above these other ones, and these ones were right in the center, and that's why we had to make those corners not rounded.

  • So they connect right up next to this thing.

  • So it looks really nice.

  • Now, with all that out of the way, we can finally start working on defining our price heading section here.

  • So if we just move all the way down to the bottom of our code, we remember we created a class and we call that price better.

  • And inside of here is all over content.

  • Dollar signed the 20 the month as well as the professional.

  • So what we want to do here is we want to change this to be a display flex, but we want to keep them above and below each other.

  • So we're gonna change the flex direction to column and this shouldn't change anything at all.

  • And as you can see, nothing, our design has really changed.

  • And the reason for using flex box is so that we can very easily line these up in the center so we could just say a line items in the center.

  • As you can see, Oliver content has been pushed so that all the text is aligned in this center.

  • Also, since this is for our heading, we want to change the font family toe, our header font family just like this.

  • And as you can see, it's increased our fund a little bit.

  • It makes it look a little bit nicer.

  • And lastly, everything inside of here should be bold.

  • So we're gonna change the font, wait toe bold and save.

  • And now, as you can see, it's already looking more professional.

  • But of course, this section needs to be contained and we give that a class of price.

  • And if we just change the display here to flex immediately, everything is gonna be shown on the exact same line.

  • And it's already starting to look a lot better.

  • We, of course, needed change the sizing up all of our different elements.

  • So the first thing I want to do is change the size of the 20.

  • So we can do that by just setting the font size here to 3.5 r e m.

  • Now, obviously, that's going to affect every single thing inside of our design.

  • So what we want to do is actually select those other things.

  • Firstly, we have our dollar sign and then we also have our other one, which is going to be called here her month thes air.

  • The classes that we defined instead of our HTML.

  • You could see dollar signs and per month, and we want to do is we want to drastically reduce this font size.

  • So for the dollar sign what's just tried out 1.5 are Ian.

  • As you can see, that's moving up to the top.

  • Looks nice, but it's a little bit too high, especially when you compare it over here.

  • So what I want to do is just move it down a little bit.

  • We're gonna set a margin on the top.

  • I will just say 0.5 r E m And there we go.

  • That's moved it down a little bit.

  • I consume this out so it's a little bit easier to see.

  • Also, it's a little bit too close to our 20 so we're gonna put a little bit margin on the right, and we just say 200.25 R E m.

  • And as you can see now, that looks really good and it's actually really close to our mock up designed over here, not leading back to this.

  • We definitely need to reduce the size of per month so we can do that by just selecting this for the font size, and we'll try out here.

  • 0.75 party.

  • Um, as you can see, that's drastically decreased the size, but it's a way up high.

  • We need to make sure we justify this at the very bottom.

  • So we can do is we can say a line self flex end, and this is just going to push it all the way down to the bottom.

  • But clearly that doesn't look right.

  • What we want to do is add a little bit of margin on the bottom.

  • Just to scoop that up, we'll say 1.1 R e m as you can see it now, it's right next to our 20 which looks really good.

  • Also, we want to make this capitalized so we can say text transform, oops, uppercase, and that's going to make our m o going to be upper case.

  • No matter what happens, we could do the exact same thing with our plan name being coming here, and we can set the text transform to up their case.

  • And now, as you can see, that has changed this to other case and it looks a lot better.

  • We can also modify the rest of our plan name.

  • While we're here, we can set the font size, which we want to be slightly smaller Will be 0.9 r e m.

  • Because you can see this slightly smaller response eyes.

  • We can also change it so that our margin on the top is going to be one R e m.

  • Just give us a little bit of space between price and the planning.

  • We don't really want any margin on the bottom.

  • We already have a divider to take care of that.

  • So Well said the margin on the bottom 20 Because you remember, we have this faint line which is going to take care of the division between the top and the bottom of our design.

  • Now, speaking of that divider, it's actually time to add that into HTML.

  • We want to do that outside of our price center.

  • We're just gonna created a div.

  • We're gonna call it divider just like that, and we don't need to put any content inside this divider.

  • We just want to make sure it's in all three of our different price columns, and then we just need to style that.

  • So we can say divider we want to do is we're gonna give it a height of one pixel and a width of 100%.

  • This way, it's going to take up the full with, but only be one pixel tall and we're full.

  • Now, just gonna give this a background whips background color of black just so we can see it.

  • If we go over here, you can see we have this really harsh black wine, obviously is pushed up writing and start content, which we don't want.

  • So we're gonna give it a little bit of a margin on the top of two r e m and the same thing on the bottom of to R E M.

  • And that way it's gonna push away from our content just like it's doing over.

  • Instead of our mock up and the reason we're putting the margin on our divider, this'll weaken evenly spaced our top content from our bottom content away from the divider.

  • Now, the next thing to do is obviously changed the color because black is way too harsh.

  • So we're gonna do is actually do a mostly transparent color which is going to be black, so we're gonna use 000 We want to make it almost entirely transparent.

  • Only 10%.

  • And as you can see, it's gonna give us a really faint line.

  • Let's bump that up to 20%.

  • Just so it's easy to see inside the recording.

  • And as you can see, we have that really faint line right there.

  • But obviously our divider here we want to be white instead of black.

  • So for our popular column, we're gonna do this.

  • Price column got popular.

  • What we want to do is we want to specifically select that divider, and we want to change the background color so we can check the background color again our g v a.

  • And this time we're gonna use White.

  • So to 55 to 55 to 55 then point to again.

  • And if we say that you see now we have a white faint line which looks a lot better than the black did.

  • Now the next thing we have to work on is the most important part of the price comparison, which is going to be all of these different features.

  • And that's where these two icons come from.

  • We have the check circle as well as the X Square.

  • This is for bad.

  • This is for good, and you'll notice inside here this stroke.

  • I actually changed this stroke from the downloaded file to be this specific color.

  • So if you want this specific color for both of these, make sure you download it from the get have repo link in the description below.

  • So now let's go back into HTML and start adding in these features, and we can just add them directly after our divider so we could have a feature.

  • And inside of this future, we're going to have the name of our feature, which in our case will just say Feature A and we also wanna have that image.

  • So what's make the 1st 1 a good one?

  • So we'll say the source of their check circle SPG just like that.

  • What's copy this down for a couple more features?

  • And of course, the indentation didn't work.

  • So let me just fix that one more here.

  • There we go and we have feature a featured B, C D e, and let's just do one more.

  • Forget major feature F just like that.

  • And on this very first this very last point, this $50 plan, all of these features are gonna be good.

  • They're all going to use the checks circle SPG so we can keep this as is.

  • Now it's copy these features and paste them up into our next one, which the $20 a month plan And if we pay sees down save, we can compare what we have.

  • So far as you can see, we have our icons.

  • We have our future names.

  • It's starting to come together.

  • But one thing we want to do is we want the bottom features to be invalid features.

  • So we could just come in here and say inactive and we can change this to be our X square, just like that same thing.

  • But this one will change this to be our X square, and we wanted to be inactive.

  • Thes Other features, though, are gonna be perfectly fine to keep around.

  • Must just fix that indentation.

  • Copy this up into our very last $10 month section here and again, fix our indentation.

  • And almost all of these are gonna be this x square.

  • So it's just coffee this up toe All these except for the 1st 2 And make sure that we set them as in active.

  • There we go.

  • Now, if we look, you can see that we have Our Red X is being shown up our green check marks.

  • Everything is starting to look really good.

  • So let's go over and actually select those.

  • Remember we called the class feature and the main thing we want to do, which I do on almost everything has changed the display to flex.

  • And we want to align these items in the center.

  • It's just going to make us our icon and our text are actually centered right with each other.

  • And it also has pushed them up right next to each other to give him a little bit of space between each other.

  • We're gonna set the margin 2.5 r e m.

  • Just give us a little bit of vertical space between our elements.

  • And the next thing we can work on is styling our image so we can say feature image and we want to come in here.

  • I'm gonna set the height to 1.1 again looks and the with toe 1.1 Ian.

  • Just like that.

  • And the reason we're using E.

  • M and said our GM is that GM is gonna scale off the front side of our feature.

  • So if we increase our feature font size are Icon also increases.

  • For example, we change this to to R E.

  • M.

  • You can see our icons scales with it, but if we used our AM down here are icon won't scale.

  • So that's the reason we're using e m down here instead of r e M.

  • Also, I want to give this a little bit of a margin on the right because, as you can see, it's very pushed up against our stuff, Solider said.

  • 0.5 R E m.

  • And every guy that looks a lot better now.

  • The last thing to do is to make these features down here, be great out and have a line through them.

  • So let's say our features that are in active.

  • We're going to have a color here which is going to be 999 which is just a grayish color.

  • We come over here, we can see that these turned it is light gray color and we can also change the text decoration line tow line through.

  • And if we say that you see that draws the line through them, which is perfect.

  • And now we're already getting really close to the end.

  • The last thing we need to do before a button is toe add up a mostpopular section up here.

  • And instead of doing this little button looking thing, I just want to have the text most popular at the very tough.

  • So an index, Let's find out $20 section, which is right here and inside of our price column.

  • We're just gonna create a div, which is called most popular and inside of here.

  • We're gonna put the text most, huh?

  • Euler, just like that.

  • As you can see, that showed up there on what we want to do is actually just absolutely position this.

  • So we want to make sure that we change our price column Popular toe have here a position of relative, and then we just for all the way to the bottom we can select our most popular.

  • We can position it absolutely.

  • And now we can just set.

  • For example, top 2.5 r E m.

  • Left 2.5 R E m.

  • The rate 2.5 R E n And if we say that and make sure we set the text aligned to center, you can see that's going to be centered in the very top of our page.

  • Lastly, all we need to do is Tex transformed because we want this to be all upper case.

  • We also want the fun to wait to be bold.

  • And of course, the font family is going to be our header font.

  • So we'll just come in here and select that with our heading font.

  • And if we say that you can nasty, that's really standing out and letting users know that this is the plan that they should purchase.

  • Now all we have left to do is add in this button the animations for when we hover over it, and this is gonna be a ton of fun.

  • So inside of her index was just scroll all the way to our very first feature at the very bottom.

  • All we want to do is create a button with the class which is going to be C T es, which just stands for call to action.

  • I will put in the texts.

  • Start today.

  • What's copy that button down toe all of our different features sections just like this.

  • And as you can see, we have these incredibly ugly looking buttons, so we should actually start styling these, and we could just select C t.

  • A.

  • The first thing we can do is just obviously remove the border so we'll say border none.

  • And we're gonna set the background color to our accent color.

  • So we'll say accent color like this.

  • And this is working great for these buttons on the outside here because they want them to look like this purple color.

  • We're gonna first focus on our purple color, and then we'll do the white color later.

  • Also, the color inside here is going to be white for a text, so it's easy to read.

  • And if we look over here, you could see now it's a lot easier to read next.

  • We want our button to fill the entire width of our container so we'll say with is going to be 100%.

  • We're gonna add a little bit of padding to make it look nice.

  • Well, save 0.75 R E m and one R E m.

  • And already that button looks a lot better and a lot bigger.

  • Also, we can change our cursor to pointer, so when we hover over the button, we know that we can click on it.

  • Now all that's left to do is change the font family This again is going to be our heading font family.

  • We also want to come in here and change the font.

  • Wait, we want this to be bold, and we'll give it a little bit of a border radius so we'll just say for pixels, for example, and that looks a lot better already.

  • Lastly, let's move it away from our content, Soul said.

  • Margin top is going to be three are again, and now it's quite a lot spaced out of.

  • So it's right on the bottom, which is exactly what we want.

  • But right now, when we hover over it, nothing happens.

  • And I want to give it a really cool kind of animation.

  • It'll pop out at you, so we'll say on Hover as Viola's on focus.

  • But I want to do is I want to take the transform and I want to take this scale and I just want to bump it up by 10% 1.1.

  • Now, when I, however, you can see it has bumped up, but it's very jarring.

  • I want to make this a smooth transition so we can use Tran position to do that.

  • Books transition.

  • And we can set this 200 milliseconds.

  • And of course, we just want to make sure we set our default transform in here.

  • Star transform is gonna be a scale of one by default.

  • And now you see, if we hover has a really nice smooth animation as it grows into that larger size.

  • And it's really gonna catch the eye of our user, hopefully making them buy our product.

  • Now, of course, we wanna have a specific called the action for our popular column.

  • So we'll set price call unpopular for C.

  • T.

  • A.

  • And, of course, our background color.

  • Here, it's going to be white, and we wanna have our color of our text to be our accent color.

  • And there we go.

  • We've completely created this design from the design number you have over here, and we have the nice animations on our butts as well, and that's all it takes to make a price comparison table.

  • If you enjoyed the video mixture, check on my other videos linked over here and subscribe to the channel for more videos just like this.

  • Thank you very much for watching and have a good day.

Hello, everyone Today is gonna be a special video because we're jumping all the way back to the roots of Web have simplified and making an HTML and CSS design, which is gonna be for a price comparison table.

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

A2 初級

HTMLとCSSで価格比較ページを構築する (Build A Price Comparison Page With HTML And CSS)

  • 3 0
    林宜悉 に公開 2021 年 01 月 14 日
動画の中の単語