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

Syntax Video

CSS Battle LIVE! in Denver | Switch Edition

Chapter 1 00:00

Transcript

[Music]

CSS battle. This is where we try to replicate something in CSS, but have you ever watched Master Chef? Every 60 seconds, you have to yell, "Switch!" and we have to switch the keyboard and the other two have to yell at the person typing on the stump. So, we have three choices for what we're going to attempt today. These are hard. Yeah. Who votes number one?

Not many. Who votes number two? Like, okay. Okay. That one seems easiest. This is a very Colorado pick here. Yeah. Then who votes number three? Yeah, it's number two. Okay. Right. Do you need to do the hand raise for three? We all saw. Why are you moving the chair? It's not going to be aggressive. He's getting ready. He's getting ready.

Oh, yeah. We're going to run. You're right. It might be aggressive. All right. Oh my gosh, look at this squat. Holy. All right. You ready? Yes. Three, two, one, go. Yeah. So, typically you want to select the body, set the background color. It's going to be that blue color. Uh, Scott's BG color hat. Yeah. So, I mean, and this is like old school. This is how we used to do CSS before CSS existed, but it's shorter than like defining a class. Oh, yeah. Because the score is dependent on how well you do in the least amount of characters and the accuracy. Yes. Um they overlay it. And Scott has made a grave mistake which I will fix.

Um you might think that inline style is shorter, but once you start having more classes, you want you're going to want items. Yeah, you're going to want to have a Isn't that nice? You can align items on block level elements now. You don't need grid to vertically center something. We need to do Yeah. Ptag Ptag. Do we need to keep this as short as possible? I think we should just Yeah, we're going to compare our score to the leaderboard. Has it not been 60 seconds yet? How many? No, it hasn't.

Okay. Quarter two. All right. We should be helping him. Um All right, CJ, you're up. I'm getting in there. Okay, I'm just going to clean some stuff up and not talk. Build. That's a good start. A style. Style tags are the are the move. Freaking inline.

No. What are we doing here? You have several elements in here. Yes, but we'll use the attribute selector as much as square bracket. Oh my god. Yeah, that's the move. And then target this. No. Next thing you're going to do, you're going to start position absoluting everything. No, don't do that. No. So, CJ, we can accomplish this unless you know this with overflow hidden, right? You're going to you're going to put the stuff inside the circle, right? But what I'm thinking is let's do a circle. Two squares. Tilt them. Call it a day. Beers. Yes. Beauty.

There we go. Oh, CJ. What the Oh, your align items is not working. Is it align content? No, not it's not. It's It's align content. It's align content. It's You know how I remember that? Oh, shoot. Get out of here. All right. What are we doing? Align content. Yeah, I just got the align. Oh, I got rid of the word align. So, just align content.

Oh, this keyboard is so small. We should have never gotten rid of the inline styles here. All right, screw that. We're going to do No. Oh, my dear lord. Oh. Oh, you We should do Oh, select P. Y, but it shouldn't be talking. Why should be a line? Oh, no. Never mind. Never mind. We're going to put uh the squares in here. So, dip.

There's no emit. We'll give that an S. Okay. We need two of those. All right. So, yeah. So, those are going to be the two triangles. I guess if Wait, did we try to align items and align content and neither of them work? I think we tried both. I think we did a min height 100% on the body. I don't think we do.

I've done it by using Oh man, typing for me has been the worst. [Applause] It's in the clipboard. You didn't spell background even. No, I know. I never type full words. It's all shortcuts.

Okay. So, I'm guessing like if I were to do this, I would do like a rectangle and then rotate it. And I guess they're going to figure out how to do that. Yeah, that's what we're going to do. We're going to do that. Okay. Two rectangles inside the circle. I don't know why they're not inside though. Why isn't that working? Because do min height 100 VH on the body. Your body does not span the height. Oh no, it does because the the blue. Yeah, guys, why is this not working? How does just do display grid uh content center? No, no, then then you you're dealing with Also, why is this not being shown now that uh Oh, this is you just do clip content for the ch children. This is easy. You just rotate it. Yeah, I got this. Okay, get ready, CJ. You're I'm I'm ready. I'm going to just finish it right now. Okay.

[Applause] Absolutely. This is not Italian. I didn't even finish typing it. Absolute. There we go. I put overflow hidden on the on the uh Y. So why is that not overflow hidden? Oh my god. Why are you doing that?

Place content. Place items center. Okay. Place is both ways. We should probably left and right. Align is up and down. I always remember because judge duty does not just no justice for judge Judy right and that's how I remember justify is left to right because he wags her finger a 100 times and I don't know what he means by that you know what I mean the way I remember justify is left to right is because judge Judy does justice let's help CJ uh oh why isn't this getting an overflow hidden why isn't the y getting an overflow hidden I g I gave it over what is the why the circle All right. Oh, shoot. Okay, let's fix the Y.

All right. Uh, why doesn't the Y have overflow hidden? What is why on this paragraph? Yeah, it should have a Oh, is it cuz you can't put a a div in a paragraph? Yeah. That's it. Yeah, just just delete that closing tag.

Okay. Okay. And All right. I already did a position relative on it. So, and there's an absolute. So you can just start moving around. And we have another one other than S in there. We have a second one. Is it also S? Translate. Yes. Uh why are we doing transform? Well, I feel like top left would be less characters, but yeah, we already have it positioned. Absolutely.

All right. Oh no. Now we're mixing and matching them. Okay. Make it. It needs to be bigger. All right.

Yeah. So, he's trying to get that. Are you going to do the bottom left or bottom right? Let's see. Probably bottom left. Get that in the exact right. Yeah, we need to get that circle in. Can somebody please look up align items center on a Well, I'm in Firefox. Is that why it's not working? Block. Ah, Firefox.

Really? possible by No, I did a video on this. Hold on. Align items align. Margin top works. Element. Sorry, it's fine. It's margin top. Margin top. Great. Margin top. And then we can get rid of all that grid stuff. Yeah. We're just making a mess now.

Yeah, we don't need grid. Oh, starting to look good. Yeah, good. Yes. You're welcome. Oh, that looks good.

Sorry. Switch. Can I ask you to leave? Premature switching. Um, so that will style that one. Just code. Yeah. And then we override. You just want Okay. You're just overriding it. We need two. Or are you going to use a a box shadow? He has a second one. And there's two of them there. So, he's just going to override it with the second one now. It exists now. Um, and is it is it big enough? Okay. No, it needs to be bigger.

I feel like it needs to be bigger. So, this overriding strategy override the width and heights, too. Oh, what? Oh, good morning. I don't know if I'm going to be able to do this. There we go. You don't have to put the px on if it's pixels. Did you know that? I did not know that. Yeah. And you don't have to close half your tags if you don't want to. Like, HTML is so freaking Oh, man. CJ. Left. Left. Left.

45. 44. 40. 43. 44. 44. 44. 44. Wes. Go. 44. The circle's off. We need to push the circle down slightly. All right. Uh, I don't even know about that. Yeah. Yeah. Uh, is it this one? Left. Morty. No. Down. I think we have to change the width and height. Other one. Go. Go down. Down. Down. Down.

Down. Down. Yeah. That's it. That's it. Okay. Uh, and then the T T. This needs to be even up by one. Oh, up by one. 101 or or 99. You did 99. Didn't work.

Yeah. Oh, I The diff is messy. Width and height need to be bigger. I think I don't. Width and height 2011. 202. to start tweaking it. Maybe top 20. This is the This is the hardest part. It's cuz the I The diff is goofing me up.

Maybe give this a What are you doing? All right. Take us home, Scott. You got this. I don't even know. Yeah. Top top 103. Uh, no. No. Don't Don't Yeah, we have a 99.9% match right now. No, the left needs to go more. Put the diff back on.

Yeah. Oh, we're almost there. 40. 40 left. 40 left. That's now top 10. 102. No, I think we got to make it as small as possible now. Submit. 99.9% match. There's another one coming.

It's got to be 100%. No. No. What? Dude, half a pixel. Top 101.5. Half pixels are valid. Displays are multi- uh they're like high pixel density. Everyone always gives me [ __ ] for using half pixels. It's allowed. It's because it's fire submit. I did.

All right, CJ. I think we nailed it. I think it is probably because the the server renderer is probably using Chrome. I think we got to call this. Holds. Whoa. No. What the hell are you doing?

Are you He's making it smaller now. Okay. 604. That's pretty good. I I would like to declare victory here. I'm sorry. Yeah. But let's let's make it smaller. So CJ is The last one I did, I just ran it through a minifier. I'm not doing it. Are you kidding me? Yeah. No, not cheating. No, it's not. I do what I want. There's no rules.

We I want to do one where there's only AI. You don't you can't write any code yourself. Why? So hard.

All right. Submit. We're at 709. [Music] 605. You know what? I think should we call it? It looks good. Pretty impressive. It's It's actually less stressful.

11 minutes. That's less time than we get doing it ourselves. And that was less stressful. You work as a team. It's amazing what you can get done. Thanks everyone. Thank you. [Applause]

Quote it with credit and a link. Quoting Syntax