Syntax Video
CSS Speed Challenge! Devs Race to Recreate React Logo
Transcript
Yeah, I'm rolling. Recording. Recording. Recording. Okay, hands off the keyboard. Welcome to another CSS battle. This one's going to be a little bit different today. Instead of trying to get to 100% with the fewest number of characters to recreate this image, it's the first one to finish. So, all three of us, Scott, Wes, and I are going to compete to recreate this React logo with CSS. And the first one to be done is the winner. Are you all ready?
Yes, I am. Ready? Go. Okay, we got to move, move, move, move, move, move, move. Okay, we're going to say 50 pics. 50 pics border. Uh oh my god, not a good time to um 50%. Okay. Okay, let's move it. Let's move it. Let's move it. So, my idea here is I'm going to take that div, give it a width and a height, and then a border radius of like 20 px, something really high, and a border 10px solid with that. Okay, there needs to be no background. The body is going to be background this. Okay. So, I'm going to set the background to that black color.
I think I will still remove the margin on everything so it doesn't mess up the styling. So, everything margin zero. I'll have a div. We're going to Let's do the orange one. Let's just get that orange oval in the exact right spot. Give it a class of O. And we'll give it a border of two pixels solid, that orange color. Do like a width of 100 and a height of 100. And I do have to target that. Okay. So, it's probably it's going to be bigger than that. Probably 10 pixels. We have to set up the border radius. Let's do 50%.
And then we'll also work on the width and the height on here. I'm going to do a body. Oh, come on. EMTT. Of course, I'm uh now I'm trying to go too fast, so I'm just like massively uh making mistakes. Uh style equals align content center. Okay. And we're going to say margin uh zero auto um 50 pics. 50 pics.
Okay. It's not 50 pics. It is 40 pics. It is 40 pics. It is perfect. It rules. Okay. Let's go. Um and then we're going to do and before and after. Div before div after. Okay. Um background color. Let's do this color for this one. And then transform rotate. Oh, we're going to do rotate 45Β°.
Um, display block content empty. Okay, I'll make the height bigger than the width. So, the height, let's say, is like 200. And then let's do a transform rotate of let's say 25Β°. Dogative - 25Β°. It looks almost exact. And then let's just get it into the right spot. So, I'm going to make it uh position fixed. We'll do top of 20 pixels, left of 20 pixels, and then go even more from there. So, like 60, 70, 80, maybe it's 100. And then just get it exactly aligned. So, we'll move it. Let's get the top left exactly aligned, and then we can work on the width and the height.
So, let's go over a little bit more. 140, 120, and then top a little bit less. 135. And then let's make it longer. Probably like 250. Yeah, I think getting this aligned is going to be the hardest part. Yeah, I think this is close, but it's not 25Β°. It's probably 20, no 30Β°.
Yeah, this is really close. I think getting this one aligned is going to be is going to be the hardest part. The A is going to include the styles that put it in the center. So, a position fixed. It's going to be top of uh 50% left of 50%, we're going to do translate 50 or negative 50% and negative 50%.
This is a trick to put something position fixed in the middle of the screen. This is going to have border solid. Let's do five pix for now. And then this color it is going to have a border radius of it is going to have a border radius of let's say 40 pix for now. It's going to be a weird border radius. Width is going to be 100 pix.
Height it's going to be 100 pix. The border radius I I guess it should be 50%. 50% and then not just 50% um it should be the width and height are going to be interesting. So, the width is going to be something more like 80 and the height is going to be something more like 200. And for some reason, this did not get put in the center pix. There we go. It's still not in the center. That's actually very odd that it's not in the center. Top auto, left auto. That doesn't work. Great. Right. Let's just get this in a position. I'm just trying to get this in here and ready to go. 35.
Oh, this is not what I wanted to be doing on this. We're going to say width is 100 pixels. That seems more right. We're going to rotate it uh 45 de. And it looks like that's too much. We're going to rotate it 35 de.
That's closer. 30 de. Okay. The height can go more. Height to 40. Of course, that throws everything out of whack. Okay. Uh, now we need to stack them on top of each other. So, position absolute top zero, left zero, and then let's just start pushing them down. Ah, the height needs to be higher. 60, 50. Uh-oh, this is starting to go south for me. This is not what I thought would happen.
I have no idea. Like, just getting that in the exact spot is the hardest part. Dang it. Okay, it's definitely a little less than 10. Let's go with 8 pixels, 9 pixels, 11. No, it's 10. It's got to be 10. Absolute. Am I spelling? There we go. Okay. Okay. Okay. Okay. Okay. Let's do background red.
Okay. Um body align content center. Okay. Uh text align center. Margin. That doesn't work. So, we'll put a margin zero auto. Okay. That got it in the middle. Good. Okay. Oh, that's not 45Β°. All right, I got to I got to figure out how to make these a bit better. Let's do pixels instead.
Let's do 100 pixels because that is going to be standardized a little bit more. Okay, that's really close. Width is now going to be 80 pixels. Width is going to be 90 pixels. Dead on. Okay, this is the green one. So let's now do B is going to be background or this is border color. Okay, there we go.
And then a height of 230. Yes. Yes. This is so close. Oh, CJ's going. Yes. Yes. I'm doing amazing cuz I use eight box shadows. Is Wes celebrating cuz he won? So because we figured out the exact shape, now we just need several more of these. So we have the orange one. We have the green one and then we have the white one. So, I'm going to style all of them exactly the same and then adjust their position and background. So, white and then green. Oh, border radius 50%. There we go. Why was I using pixels? Okay. Okay. Okay. Okay. Okay.
We're in good shape now. Okay. Now, this needs to be they need to be angled up a bit more. So, 55Β°. Let's get the actual width dialed in first. This is going to rotate negative 30 de. Okay, cool. This last one, which is D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D 180 no 90 beauty background color for this one is in fact this normal color. Now we just have to get them to be in the correct order and I win uh if I can do that.
Now let's position the green one. So it's going to have a background of this green color. Not a background, a border. So the border will be this but with the green color. It has the same width and height and then just a different rotation. So instead of negative 30Β° it'll just be 30Β°. Yes. Perfect. And now we need the white one.
Okay. And then the width needs to be 230. Okay. And then the height is probably 80. The height needs to be higher. All right. The height is right. The bottom one is D. The next one is Let's go. Submit. Submit. Submit. Submit. Submit. Submit. Submit. Submit. Submit. Submit. Give me that 100. 100 100 100. Let's go. 99.8. What the?
They're ever just so slightly off. Now I need to make sure that they're in they're in the right order. So the white one needs to be the first one drawn. So it's underneath. And then the green one needs to be underneath the orange one. Okay. This should be perfect match in the center. Yes. Last thing we need is that little blue circle. What is going on? The these circles are different size. What? width 250 px. No, that's not right. Is it because I did absolute positioning? Something goofed up here. I don't need that. Let's try 60. What am I doing wrong here? My They need to go up and over. Why top? Oh, maybe to account for the border. Yes.
Left -10 px. Yes. Okay, got it. 90.5. Does that do me any better here? Oh my god, I'm so close. No, it's all slipping through my hands. I heard it. So, I'm going to add one more div. Uh, we'll give it a class of C for circle.
Background of that blue color. Let's give it a width of probably 20 and a height of 20. Border radius of 50 cent. 50%. And it's even bigger than that. So, let's go up to like 50. Smaller than that. Is it 30? 30 looks pretty good. It could be 35. Let's go with 35. And then now we need to position it. So top 200 pixels and we need to make it position fixed.
I'm just submitting. Please just come on. Come on. Background radial gradient circle. What color is that? That's the blue. Start at zero. Go for 10px and then transparent zero. Okay, good. How much better can I get here? This is going to be way. Okay.
So, I need to I'm going to get it positioned exactly at the top. Come on. Come on. Come on. Come on. Come on. Come on. Come on. Come on. Come on. Come on. Come on. Come on. Taking forever to submit. 100% match. Done. Width of 40 and a height of 40, I think. And then left of 180.
Are these jokers still going? I cannot get past 99%. Submit. 100%. 100%. Yeah. 100% match. Done. Why can I not get past 99%. What the absolute hell is is wrong here? Easy. I could have gone faster. I mean, I get that I get that the diff is ever so slightly off.
I'm going to go get a drink. Wes is just taunting. Wes technically beat me, but he he did not submit a screenshot in the Slack. Chime in the Slack with with a screenshot to prove it. So, there's no proof that he actually won. No, Randy, we have video evidence. I don't know about that.
99% match. Are you [ __ ] me? I don't need a screenshot in the Slack. That's what we agreed on. I think you messed with the time stamps. All right, I'll go first. I got to 99% like instantly and then could not get past 99%. It looks pretty good. I get that it like has a little bit of stutter here, but I was just tweaking, you know, like point percent or point pixel values just in an effort to get it past 99% match and I could not do it.
Your your border needs to be 10 pixels, not 9 pixels. That's the issue. It was It was What was your width? So, I have 90 for width, 230 for height, and a 10 pixel solid border. But I had I didn't use translate. I used a fixed position. Maybe that is what's messing it up. I mean, that could very well be the problem. But like I had Yeah. those values and I could not get it past 99.9%.
The crazy thing is that you got your score is almost better than mine though. You're still code golfing it. I did not. I just it's so nice not to fuss with those um all the little tricks. Yeah, I'm just shocked that I couldn't get this couldn't get it past the line. All right, CJ. So, I just have four elements fixed pos I'm like the fixed position king at this point. Just like I did fix position as well.
Yeah, just get it exactly and then position it. So, this is I styled the orange one first and it has a top of 25, a left of 145 and then they all get the same styles. They just override the rotation and the border. As I was going at the end, I had to figure out the correct order to draw them in cuz it goes uh orange is on top, green underneath.
Lucky. Yeah. And then white underneath. I got that. Yeah. Yeah. I drew them in the in the wrong order, but I just swapped around my divs and then they're they're painted in the right right position. Yeah. Just fix position. Nothing crazy. All right. I used um align content center to put everything in the middle. I'm I'm like so so done with absolutely positioning everything and trying to push them over, you know? It's always a nightmare.
I use a radial gradient again. That's my like calling card now. I called that I bet Wes is using radial gradients here for some dumb reason. Yeah. And then uh a before and after. So basically the three parts are the div a div before and a div after. And then I basically clocked the before and after values. And then the only thing that was was messing me up was that there's there's no border box set on this by default. So everything was a little bit off and it was because I had to account for the size of the border. So I had to bump it up and over 10 pixels. Pretty fun. Obviously I'm the winner. Uh again, good job, man.
Yeah, I'm I'm surprised you got with before and after. You just drew them in the right order cuz that would have been so lucky that that happened cuz I I don't know that I would have I would have been getting into Zindex then, you know. I guess I could have swapped them, but that was just dead lucky. Yeah, congrats the reigning champ of CSS battles.
I'm exasperated because I spent so long at 99% just hitting the button like get there. This is for the win and I could not get there. Yeah, we almost need like a like a jury. You can appeal to the jury being like this is this is 100% right. I would like to appeal to the jury. Uh but since many of the commenters think that I am a self-absorbed ass hat, uh I would lose that appeal.
Wes is the reigning champ. Congrats, Wes. Uh if you enjoyed this, you'll definitely enjoy one of these other battles that we've done here.
Quote it with credit and a link. Quoting Syntax