Skip to main content
View on YouTube to comment and like!

Syntax Video

15 Minutes to Rebuild This Product Card… Winner Takes All

Chapter 1 00:00

Transcript

The syntax team has been working really hard to get syntax in order for Mad CSS, a competition we have coming up in March. We're going to put it to the test today. So, I have created a target for Scott and West to do. We're going to see if they can get it done in 15 minutes. I am so stressed that to do this, but also that the platform won't break again.

The platform [laughter] is really Yeah. But we've been working hard and let me tell you in this work we've been using Century every step of the way to fix all of our bugs and errors as we go. Man, the past week, two weeks, 3 weeks, it has been essential for us. Yeah. And so, a quick rundown. Uh the boys have not seen this target yet. They are going to be implementing some product cards. A few ground rules.

Everything is a multiple of five pixels. So, font sizes, border radiuses, widths, everything is a multiple of five. So, it's pretty easy to dial in. And there's not going to be a lot of pixel pushing like on CSS battles. I think that's it. Are you guys ready? Yes. Not at all. Let's do it. [laughter] Let's go. Okay, let's go. Okay, so you know, I feel like we normally talk during these things, but I'm so stressed out right now. That's not the right gray. There's several different grays in here. Uh, charcoal.

Okay. Um, did I put this on the wrong div? No, I made this div a div. Um, div a div a div. There's too many divs. Yeah, Scott's getting right into it. Defining some classes. This should be display grid. Grid template. No, this is rows.

Wes is immediately reaching for grid. We'll see if that works out. Since I set the challenge, it is uh flexbox on everything, but you could definitely do this with grid, but the spacing kind of relies on it being flexbox. So, we're going to say the immediate div of this is going to be display flex flex direction column. Dude, Zed has some [music] awful CSS.

The image is going to be a width of probably 100 px. Yeah. Border radius probably five. Man, I love that everything is five base. It makes this a lot easier. Oh, CJ, this image is is cropped. Yeah. So, the images should be pretty easy. There's a there's a pretty standard thing we do with images. Yeah.

Yeah. Wes got it. And then the image inside of here is going to have a width of 100%. [music] I suppose that should fill its container. Why in the world is it not affecting the bottom one? Why do I have two different things here? Div with the class of list. I goofed my HTML up so badly here. Why? Look at there's one pixel too high. CJ, you told me there was Oh, it's He's probably like vertically centering the items. Screw it. We're moving on to the next thing.

Container. We're going to say that the container [music] div is going to have a margin. You know what? I'm going to do this as a hard-coded uh pixel value. I feel like that is the correct strategy [music] for this competition right now. Everything give it a margin of zero. Yeah, they're both reaching for margins. I didn't use a single margin in this target. Like I said, everything's flexbox with gap. Like I I would assume that's kind of the standard way people would would do this. Why is everything gritted? Oh, a star. I needed an and I was gridding literally everything all the way down. So I was right. [groaning] Why is there no classes on these things, CJ? I guess I can add classes. Hey, I could There's nothing wrong with changing the HTML. Oh boy, I'm so good.

Look at this. And the best gap 20px. Boom. Okay, where are we at with the diff? Oh no, Scott's at almost the same amount as me. Yeah, the diff the diff shows similar, but Wes does look closer. He's got the border radius dialed in.

Let's work on getting this. So, auto 1FR auto. Okay. And then we want to align content center. I think we also want to align content center here. No, that didn't work. Wow. Yeah, Wes is getting much closer. I'm liking this.

And also, we have buttons. What are the buttons? So, I might as well get the buttons right cuz if we're going to run out of time. Uh, border solid 2 pixels or one pixel. This looks like a two pixel var. Zed, what are you doing to me? I got to turn off this whatever this garbage CSS autocomplete is in. Zed. Yeah. So, Scott's narrowing in on the buttons there. Got to turn them into circles.

Color [music] var color yellow. We're not going for smallest code here, so I'm just kind of slopping right now. border radius percent. This autocomplete is so unreliable. Align item center. There we go. That's a little bit closer. Stupid.

And again, this is another flex box. If if you flex the whole uh container with all the buttons in it, they'll line up pretty nicely. What is wrong with mine? It starts too low and doesn't go. What is wrong? I really need to figure out the spacing. Okay, so the it's fine at the top and fine at the bottom. But mine just has too high of a gap. But then they go smaller. Oh, here I'm in a weird spot.

Yeah. Now Wes is looking closer. I think he's just trying to get the cards lined up before he starts working on what's inside the cards. And that's probably the way to go. You're going to get a much higher match percentage if you can at least get the the cards in the right position. I'm not in a terrible shape. Although the f I don't know why the first child wasn't Oh, cuz is there a div inside of that? There's a div inside of that. That looks pretty close, but it's not. The top and the bottoms are perfectly aligned. Oh, is it because the height of mine are different heights? They are.

They are. So, where's my grid template rows? Not one fr. There. That's much better. All right. That's pretty good here. I think my gap is off. So, gap could be 15 pixels. Better. Let's go. Now, this div should be a display flex. Yeah, looks like Scott's dialed in on flexbox. He's He's figured out my tricks here, but he's got to spell it right. Oh, shoot. Scott is like 2% ahead of me. I got to figure out like a quick win on on this thing. Maybe if I change what the hell this a div with text in it, CJ, come on. It mark this up properly. And why are you spelling beanie like that? These should be paragraph tags. Scott's trying to find the color. I I I wonder if naming the variable names instead of just colors would be okay. Why is my background color not the same as the target? Oh, it's color black. That's why. Am I the only [music] one who knows this? But why is it still not? Oh,

container. Okay. [music] Body. Oh, that's color. Now I've goofed up the color of the whole thing. Folks, if you can't tell, this is stressful. There we go. He locked in the background. Now he's at 84%. That's what he needed. Oh, man. How did Scott get it? I really need to figure out these these divs here. What is wrong with my spacing?

Yeah, so Wes is closer. He at least got the the top of the cards lined up. But I did not set a fixed height on these cards. It's It's really their their content. Okay, that seems right, but like why is it off? Do I just have to do like a margin top 10px on this thing? Yes. So yeah, these padding values he's using, it's going to throw things off a bit.

How did I Oh, first of type. I didn't complete that, dude. This autocomplete is going to kill me. Okay. Um, these things, the images need to be in the middle. Why is there not classes on anything? Mine is starting way too much. So, the body needs padding just to push everything in. It's going for padding again. I I feel like you could get there, but I don't have any padding in the original thing. It's all just flex flexbox and gap. I had to refresh. That's why my [ __ ] wasn't updating. Oh, now all my changes that I haven't been seeing.

Oh my gosh, I can't believe it. I was robbed. [laughter] The O broke. Yeah, only 40 seconds left. Yeah, I think Wes is going to use the platform breaking as an excuse. Oh no. Gap. I just made mine worse. Scott's Luke's better. Like Scott worked on the buttons, though. He's He's much closer. Come on. That's pretty close.

All right. Um, let's do a Hail Mary button border. Okay, you know what? Mine isn't that bad. It's not terrible. Color yellow. The time is up. Font size 20. Ah, Wes, you didn't get the background color right ever. That's why your score is so low. Oh, what? So, well, you set it to I think you set it to the wrong color is the issue, right?

Doesn't your diffing algorithm not take it into account? Oh, I didn't use any I didn't use any background color because it was the background color that is set in the reset is so close. I didn't notice. Yeah, folks. Well, [laughter] safe to say the platform Oh my gosh, I just changed it. Hold on.

I just changed the background color and it updated to 88%. I'm the winner. [laughter] No, no, I'm sorry, Wes. Perfect. And good eyes. I got good eyes. I saw that. I can't believe I didn't [music] see that, man. That was fun though. Oh, that was fun. I found a couple little bugs.

A couple little bugs which Hey folks, we built this thing from scratch. Uh Wes has a custom diffing algorithm that's using all kinds of stuff. This thing is using uh local data syncing. It's using the file system API. This website absolutely rips. So, that was pretty good. Folks, how you feeling?

I'm feeling great. I kind of want a rematch cuz I got blindsided by CJ giving [laughter] me text with div divs on. Do you not care about accessibility there? I do. I just, you know, I just thought, you know, I don't know. If we're looking at the two of these, yours is looking a little sad. I missed some details. I'm not there.

I think yours is closer. Yeah, Scott wins this for sure. And the given that I wrote the algorithm, I win. [laughter]

Quote it with credit and a link. Quoting Syntax