Front-end developer takes on a CSS battle

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ • 120

  • @adampielach4942
    @adampielach4942 Рік тому +136

    As a software engineer, more than frontend developer - I was blown away by the way you come up with those solutions so fast. Also, it shows me how much CSS has evolved in the last couple of years. Great job!

  • @mahadevovnl
    @mahadevovnl Рік тому +33

    First one is just a square with a before and after inside. The square is centered, the before and after are just the vertical and horizontal bars. Just need one div :)

  • @fogofwar342
    @fogofwar342 Рік тому +12

    LOVE these css battle videos. Can we get this weekly plz?!

  • @DavidAltreiter
    @DavidAltreiter Рік тому +57

    As all the circles have a 90deg cutout I would have just used a border-color of transparent on one side and then just rotate the thing 45deg. Would have worked for the second challenge too.

    • @edwardholmes91
      @edwardholmes91 Рік тому +3

      I was thinking thr same thing. I learnt about it when I was using ::after to create an arrow on a tooltip.

    • @BrandonWalowitz
      @BrandonWalowitz Рік тому

      What do you mean by this?

    • @gwemula
      @gwemula Рік тому +3

      @@BrandonWalowitz Probably means to have a fat border and color all side, except the one transparent side.

    • @DavidAltreiter
      @DavidAltreiter Рік тому +1

      @@BrandonWalowitz just like @gwemula said, you can individually set the color of a border on each side. so if one is set to transparent it leaves a 90deg cutout (on a rounded div with equal sides of course)

  • @clevermissfox
    @clevermissfox Рік тому +1

    Ive been avoiding that last one on css battle so its very helpful to see your approach!

  • @imni29
    @imni29 3 місяці тому

    Omg I was stressing during the last one 😂 then boom you got it 👏🏽 GREAT job 🎉

  • @TheCocoaDaddy
    @TheCocoaDaddy Рік тому

    Wow, that's insane! You're amazing!!!!! Thanks for posting!!!!

  • @gwemula
    @gwemula Рік тому

    The video and the comments combined really help open up new ways of thinking about the same problem! Love these videos!

  • @valeryi3374
    @valeryi3374 Рік тому +1

    Thank you Kevin for your great content!

  • @saravananv.k3567
    @saravananv.k3567 Рік тому +4

    Hello Kevin, You're the one that inspired me to get in into css world. Thank you very much❤

  • @ivlis.w
    @ivlis.w Рік тому +6

    Today I learned conic gradients could be pretty useful

  • @JasonLayton
    @JasonLayton Рік тому +1

    This was entertaining to watch. I am enjoying your "conquering responsive layouts" course. Thank you.

  • @LePhenixGD
    @LePhenixGD Рік тому +2

    After watching your video, I decided to do these challenges myself, and I'd like to share what was my thought pattern throughout the challenges:
    1:12 We can get 1 div and use 2 pseudo-elements, we center the div in the middle, and we set the width to be 100% of its parent element and then just scale on the X axis both pseudo-elements and rotate by 90deg one of the pseudo-elements
    4:30 I'd have used a div and played with the border radius by setting the border-block-start-color to be orange and rotate by 45deg
    7:50 I pretty much had the same thought process as Kevin here
    10:50 I used the same previous trick with the border-block-start-color on 4 divs and played with the top-left values until I found the magic number

  • @fawazabolaji9522
    @fawazabolaji9522 Рік тому +2

    I'm new to frontend just finishing watching a HTML CSS course ans this looks like magic ngl 😢

  • @anselum540
    @anselum540 Рік тому +4

    Rotating the conic gradient degree would be a great option for the last one 10:50 😊.

  • @danser_theplayer01
    @danser_theplayer01 Рік тому

    It's good that youtube keeps recommending me this dude, even though I'm much more of a javascript sorta guy.

  • @stephenbrown2979
    @stephenbrown2979 Рік тому +1

    I've been playing CSS battle for some time, and over time I have learned some the tricks needed to achieve the desired outcome with the simplest code. The use of various combinations of background gradients can be a powerful tool. Example, I was able to complete puzzle 160, the donut, using only a combination of a radial and a conic background gradient on the body. body{background:radial-gradient(1q,#62306D 60px,#0000 0,#0000 100px,#62306D 0),conic-gradient(#F7EC7D 75%,#E38F66 0}

  • @saar5947
    @saar5947 Рік тому +3

    the CSS king is back!

  • @younessehorra5592
    @younessehorra5592 Рік тому

    That's the video that I've been waiting for ❤ , from 🇲🇦

  • @the_BetaDev
    @the_BetaDev Рік тому +1

    for battle 160 I did:
    body{background:#62306D;display:grid; place-items:center}
    div {
    width: 120px;
    height: 120px;
    border-radius:50%;
    border:40px solid #F7EC7D;
    border-top-color:#E38F66;
    rotate:-45deg
    }

  • @procoder09
    @procoder09 Рік тому +1

    Hey everyone I upload css battle daily targets solutions. So if you get stuck anywhere you can freely watch the solution.
    Thank you ❤❤

  • @LeonVisnaw
    @LeonVisnaw Рік тому

    That was fun to watch.

  • @AdamGaffney96
    @AdamGaffney96 Рік тому +1

    What I did for the last one was just make my 4 circles with a box-shadow on them, then use a clip path to cut out a 90deg section of the circle. Then just rotate and position the other 3! Honestly I think I solve about 90% of these css battles with box-shadow, clip-path and position absolute.

  • @rafi-leigh
    @rafi-leigh Рік тому

    this video taught me how to create a pie chart, and how to make it spin. thanks.

  • @GlacierGamer2018
    @GlacierGamer2018 Рік тому +5

    I'd Have Created 5 Squares On The First One, 4 Small Ones And 1 Big One

    • @saber8387
      @saber8387 Рік тому +1

      That's boring

    • @xxwaldi
      @xxwaldi Рік тому

      you only need 3

    • @VeitLehmann
      @VeitLehmann Рік тому

      @@xxwaldi Actually only 2, you already have the body that's implicitly always there. Got me to my high-score.

  • @designtoxable
    @designtoxable 9 місяців тому

    Conic gradients with transparent are 🔥

  • @jonathanbayhon367
    @jonathanbayhon367 Рік тому

    This is whole another css level 🤯

  • @technoph1le
    @technoph1le Рік тому

    17:05 That also looks cool without spacing

  • @Atractiondj
    @Atractiondj Рік тому

    IDEA for next battle - you can create a fullpage scroll section horizontal and vertical (without pressing key shift for horizontal scroll)? Reference library - fullpage.js - Scroll Horizontally

  • @Unai_asdf
    @Unai_asdf Рік тому +3

    I'm guessing z-index wouldn't have worked on the last one, since it would be an impossible (Penrose) stairs thingy were the lowest z-index element should also have to have a higher z-index than the highest z-index element. But give it time, I'm sure CSS will let us bend the laws of physics at some point (except on Firefox).

    • @KevinPowell
      @KevinPowell  Рік тому +4

      Yeah... looking back at it, it wouldn't have worked. There is a trick that would maybe make it possible, but it might have prevented a 100% match, plus it would have been way more work than it was worth, lol (you could rotate on the Z-axis, 1deg or -1deg)... I think you might have to use perspective and preserve-3d along the way as well, that way they're slightly tilted in the 3d space and can hid beneath something in front of it... but I'm happy I didn't go down that route 😅

  • @Jarrod0067
    @Jarrod0067 Рік тому +1

    I love how cheaty this game is. It's not even a challenge of writing the most robust code. Just hack it! Use short tags like and to save characters, nest them to apply absolute to them all at once, and magic number all of the width/height and top/left

  • @octothorpe12
    @octothorpe12 Рік тому +11

    for the last one, I would have changed the conic gradient, rather than transform/rotate the object.

  • @ThatRobHuman
    @ThatRobHuman Рік тому

    Interesting. In all the cases where you used conic gradients, I used borders.
    for example: #160
    body {
    background: #62306D;
    display: grid;
    place-items: center;
    }
    div {
    width: 120px;
    aspect-ratio: 1;
    border: 40px solid #F7EC7D;
    border-radius: 100%;
    border-left-color: #E38F66;
    rotate: 45deg;
    }
    for the clover, I used the same idea as above, but border-left-color: transparent;

    • @ThatRobHuman
      @ThatRobHuman Рік тому

      obviously both work, not doubting your decision one bit: I'm glad there's more than one way to skin a cat - the divergence is legit interesting.

  • @andyjulca238
    @andyjulca238 Рік тому

    so good

  • @philwinkle
    @philwinkle Рік тому

    "hello my funtime friends"

  • @jasper2virtual
    @jasper2virtual Рік тому

    Hello Kevin, your channel is very great I love it so much. I am a css beginner and I started to love to learn css because of you.
    I have subscribed to the cssbattle to play and learn. I found all the top solutions only works in Chrome but not Firefox, is it normal? And what you will recommend if I want to learn browser safe css. Thanks a lot and have a good day.

  • @bw-dude
    @bw-dude Рік тому

    Hi Kevin, I was surprised to see how you solved this. Especially since you are the master of pseudo elements.
    I would have solved the first three with one div each plus ::before and ::after and z-indices.
    The third one I would have done in a simliar way.
    Still very interesting watching you how you go about it.

    • @KevinPowell
      @KevinPowell  Рік тому +1

      I tend to avoid pseudo-elements in these because they take longer to setup that just throwing another div in there. I also often go with sub-optimal solutions thanks to having a timer going 😅

  • @tomben9609
    @tomben9609 Рік тому

    The last 5 sec of the first one went too fast for me 😆 what happened, could somebody give me some clues? I tried it by myself before the video and was like 3 divs, 2 rotated done, but then I watched you and it was BOOM so fast! Great video as always man!

    • @KevinPowell
      @KevinPowell  Рік тому +1

      lol, looking back at it I can see why it went a bit fast there, lol. It looks like one big red block, but it's actually 25 of them in a 5x5 grid. The red backgrond on all of them, and no space between them, makes them look like one big square. I removed the red bg and made only the ones I needed orange and it just came together :D - tbh though, your solution is probably better :)

    • @tomben9609
      @tomben9609 Рік тому

      @@KevinPowell Ah yes! I just realised that you had already setup the orange classes at the beginning. Thanks man, I'm just getting into grids so that great.

  • @deltaromeo8207
    @deltaromeo8207 Рік тому

    Hello Kevin, love watching your channel. I am currently enrolled in college at Full Sail University for web development and I am learning coding in one of my classes. Watching your channel has helped me a lot. Also do you have a slack or discord channel?

    • @KevinPowell
      @KevinPowell  Рік тому

      I have a Discord 🙂 kevinpowell/discord

    • @mad_circuits
      @mad_circuits Рік тому

      @@KevinPowell How much did the TLD cost you? 😂

  • @DineshKumarD-x2x
    @DineshKumarD-x2x Рік тому

    2nd one #160 you can achive only borders also

  • @aje9633
    @aje9633 Рік тому

    I think you could have done that with one div and use box-shadow instead since you can apply multiple arguments to its parameter :D

  • @padmanabhans6632
    @padmanabhans6632 Рік тому

    In challenge 159 it would take a 1 div (I know that you just want the 100% match), also this gives you a high score. Just an idea of mine.
    no offence.
    Idea: -
    place the main dive at center and use it's before and after pseudo class/elements to make a cross using position absolute it sets automatically to the center.
    if it works I happy else I learn something new today.

  • @mjerez6029
    @mjerez6029 Рік тому

    You should do a css vs tailwind Battle!!

  • @ruudlaff10
    @ruudlaff10 Рік тому

    The first one could have been one div, and used the before and after pseudo elements. The main div being a square, and then two rectangles in the pseudo elements. Just an idea to try!

    • @ruudlaff10
      @ruudlaff10 Рік тому

      Just realised I’m not the first to suggest it!

  • @penguinxed
    @penguinxed Рік тому

    youre making those challenges look easy mr kevin lol

  • @jimmynguyen5361
    @jimmynguyen5361 Рік тому

    do more!

  • @olesejus
    @olesejus Рік тому

    could do without conic-gradient by using border;
    border: solid 20px red;
    border-top: solid 20px transparent;

  • @k23raj2
    @k23raj2 Рік тому

    how to avoid button scale affect parent div height, padding css?

  • @BaeristaVR
    @BaeristaVR 11 місяців тому

    New subscriber here 😊

  • @stokbrood
    @stokbrood Рік тому

    If those design would come from figma, I would just export them as SVGs

  • @padmanabhans6632
    @padmanabhans6632 Рік тому

    just change degree of the conic gradient instead of rotating the whole div 😇[#164, Rangoli], Just an idea of mine, if it works I happy else I learn something new today.

  • @NigamTrader
    @NigamTrader Рік тому

    Ky hall hai sir kaise ho aap hum bhi start kiye h web. Development

  • @VEKTOR299
    @VEKTOR299 Рік тому

    Sick video bro

  • @pasizdobrekuce
    @pasizdobrekuce Рік тому

    Isn't the first one just three elements accordingly sized and positioned on top of each other?

    • @KevinPowell
      @KevinPowell  Рік тому +1

      You could definitely do it that way! Not how I first saw it, so I went my route, but that would totally work

    • @pasizdobrekuce
      @pasizdobrekuce Рік тому

      Yeah! Good stuff!

  • @webrevolution.
    @webrevolution. Рік тому +4

    To me, the weird thing is that I feel loads of tension from you wanting to necessarily do this as fast as possible. But I think you know very well (as we also do) that you are a very good frontend dev and probably in a scenario where you don't have to speak to the camera for a video, you would beat almost anyone of your viewers to anything CSS related. You're just on another level and the experience definitely shows. Maybe I'm the only exception (I wish I was 😂).
    Nice vid!

    • @KevinPowell
      @KevinPowell  Рік тому

      It's a fun challenge to do it with a timer, and probably forces me into mistakes at times which can make for better viewing 😂

  • @perelium-x
    @perelium-x Рік тому

    this is leetcode for front end developers🤯

  • @LokeshKumar-tk7ri
    @LokeshKumar-tk7ri Рік тому +1

    is it good to start frontend developmemt in 2024?

    • @KevinPowell
      @KevinPowell  Рік тому +3

      The current job market is pretty bleak at the moment, but from what I understand, that isn't unique to frontend development, but is an issue at large across most industries. Personally, I don't see any reason not to get into it, but of course, it depends why you want to, of course. If it's for the super high paying jobs you hear about sometimes at the big companies... I wouldn't get into it for that, lol. I'm not saying it isn't possible (and I know people who have jobs at Amazon and Google), but they aren't the norm, specially early on in your career.

  • @TechtalkAi2762
    @TechtalkAi2762 Рік тому

    😢How much css do I need to know ?
    And how can I be top in css just like you what should is I do ?

    • @KevinPowell
      @KevinPowell  Рік тому

      Lots of practice goes a long way 🙂

    • @TechtalkAi2762
      @TechtalkAi2762 Рік тому

      @@KevinPowell what practices should i do ? may you name some practices to me ☺️

  • @rocki_0161
    @rocki_0161 Рік тому

    Is there a similar app for Java?

  • @JulioCesar-ii2xr
    @JulioCesar-ii2xr Рік тому

    I have a lot of studying to do...

  • @mjdev-i1p
    @mjdev-i1p Рік тому

    you could have done the first one with just 1 div and 4 boxshadows

    • @KevinPowell
      @KevinPowell  Рік тому +1

      Really? I could see doing it with a div and two pseudo-elements (or 3 divs)... for the shadows, I'm not not sure I see how... oh, wait, one of the squares is the div, then shadows with different offsets (and one with a spread to change the size) I guess?

    • @VeitLehmann
      @VeitLehmann Рік тому

      This approach got me down to 117 characters. Actually no div, but 5 box-shadows, so I only need one background color. I found another approach without box-shadow, but with 2 elements, that got me down to 96 characters. I wonder what top 11 on the leaderboard did to get it down to 76 characters...

  • @BrandonWalowitz
    @BrandonWalowitz Рік тому

    Why did you use translate without transform and then later on with transform?

    • @BrandonWalowitz
      @BrandonWalowitz Рік тому

      Before you realized the order mattered. In the last challenge.

    • @KevinPowell
      @KevinPowell  Рік тому +1

      It's faster to do it without 😅

  • @PopCapMusicTrending
    @PopCapMusicTrending Рік тому

    hehe I will create it in ppt and do image source

  • @dimasfajar6316
    @dimasfajar6316 Рік тому

    sangar wong iki

  • @portusdelphini
    @portusdelphini 8 місяців тому

    I would make first with 3 divs

  • @vanhelsingx69x
    @vanhelsingx69x Рік тому

    whats the point of the timer? It would be way cooler if you would actually win a battle and get 100$

  • @ThatRobHuman
    @ThatRobHuman Рік тому

    On a number of these, I would *absolutely* cheat and use inline SVG....

    • @KevinPowell
      @KevinPowell  Рік тому

      I mean, SVG is the right choice here if this is what you actually need 😅

    • @ThatRobHuman
      @ThatRobHuman Рік тому

      @@KevinPowell lol, that's comforting (I often feel like I'm one of the few people who will reach for SVG first), but I totally get that's not in the spirit of the challenge.
      It does make me wonder if there's room for SVG-freaks like me for a Hand-written SVG Challenge/Battle :3

  • @the_BetaDev
    @the_BetaDev Рік тому +1

    For battle 159 I did it using box shadow
    body{
    background:#F5D6B4
    }
    div {
    width: 50;
    height: 50;
    margin:25 0 0 167;
    background: #D86F45;
    box-shadow:0 100px 0 50px #D86F45,
    0 200px #D86F45,
    -100px 100px #D86F45,
    100px 100px #D86F45
    }

  • @mannixmd
    @mannixmd Рік тому

    How is the dog doing ??😃

  • @DaisyGeorgia-e1c
    @DaisyGeorgia-e1c 2 місяці тому

    484 Kayden Via

  • @paulomodeinde1899
    @paulomodeinde1899 Рік тому

    Does anyone have a 100% solution on 169? I have 100% on everything else but 99.9% on 169

    • @KevinPowell
      @KevinPowell  Рік тому

      The 99.9% are often a small bug. Sometimes I get that when I use grid, but get 100% if I switch to flex, for example. If I got 99.9 I consider it a match 😅

  • @komailabbas4574
    @komailabbas4574 Рік тому

    i did it in 20 seconds it took a screen shot and put it in an img tag job done .👍🤣🤣🤣🤣🤣🤣🤣

  • @DNC55-v2j
    @DNC55-v2j Рік тому

    I beat you, using gpt3.5😅

  • @niteshmalviya1849
    @niteshmalviya1849 Рік тому

    responsive?

    • @KevinPowell
      @KevinPowell  Рік тому

      Not really, lol. That isn't really the point of these challenges though :)

  • @surgeon23
    @surgeon23 Рік тому +1

    Ha! Cherry-picking the easy ones I see!
    Just kidding ;)

  • @dudeyouhavenoidea
    @dudeyouhavenoidea Рік тому

    wow

  • @DaveMadeIt
    @DaveMadeIt Рік тому

    Why does it say "Finished 2 hours ago"? at this time stamp ua-cam.com/video/eYPyIq5Y3Rk/v-deo.html

    • @KevinPowell
      @KevinPowell  Рік тому

      They release new challenges regularly, and have them running over a period of time. I always wait for them to finish to do these videos, so that all of the challenges are unlocked

  • @cafelutsa_
    @cafelutsa_ Рік тому +1

    I can't for the life of me figure out why for challenge 160 and 164 you didn't use a rounded div and give the border-top the color you needed for each shape. Is it for the video to seem more interesting? Using a background of conic-gradient on such simple shapes is a very convoluted way to achieve a simple circle shape with a quarter of a border color being different. I mean, spending over 8 minutes on the last challenge has to be a show for the video, right? Just be more transparent and say, "I know we could probably use [x method] but let's see if I can figure this out using [y method]." Don't take this comment as a hateful one, but as a genuine curiosity I have when you release these kinds of videos that feature CSS battles.

    • @KevinPowell
      @KevinPowell  Рік тому +2

      These are always genuine, and my first time going through them with whatever pops in my mind at the time. I don't do these types of things very often at all (I haven't done one outside of a video in years, so you can see my frequency of doing them), and things like different border colors just doesn't occur to me. It's a great solution, but not one my mind goes to when I see that shape with the two colors. Conic gradient was the first thing that popped in my head because it's fantastic for this type of thing, and much more versatile than a border (since you can have it at any angle), so it's what I thought of when I saw that shape 🙂. I never said these are the best way to do them, but when our mind jumps to a solution and I have the "constraint" of solving it as fast as possible, I'm going with whatever the first solution that jumped to my mind was.

    • @cafelutsa_
      @cafelutsa_ Рік тому

      @@KevinPowell So you choose the solution that always comes to mind first. Interesting approach. I think the timer irks me. Showing it seems to imply that you're trying to solve the problem in the fastest way possible, but in every video of this type you seem to get bogged down. Excuse me if I seem arrogant - I don't want to and I am not trying to either - but when you solve a challenge you should take inventory of every tool that seems useful in that particular case, and not jump to solve it by applying the first solution that comes to mind. As you see, it really didn't help you out a lot. Going through a list of what goes on in your head using different solutions (why they might work, why they might not, why you would use them and vice-versa) would also make for great content. I am an active follower of your channel so I'm trying to give you as much feedback as I can.

    • @KevinPowell
      @KevinPowell  Рік тому +1

      The idea with the timer is to sort of start the entire challenge when I hit "start". Obviously I have an idea in my head when I see the small view of it, but to me, solving it as fast as possible is also coming up with the potential solution, and not just how fast I write the code for the solution I have in mind. These types of videos are less for the educational vibe than my normal ones, because to me, solving things like this is more for fun anyway, and not the type of thing you'd run into in the real world (though you can 100% learn things from these that you'd use in the real world!).
      I 100% agree going over possible solutions, and explaining though processes can be very educational. I have a few upcoming videos on that topic too, actually, where it's more about thought process and breaking down a problem rather than "here is a solution'. If anything, that's probably more valuable than just showing solutions to problems :)

    • @cafelutsa_
      @cafelutsa_ Рік тому

      @@KevinPowell These are very simple challenges though, so I do have the feeling you're stalling a little bit, knowing how experienced you are in this field. I don't know, to me, it just gives that vibe that you actively choose the "harder" solution because that gives you more screentime, therefore content.

  • @MD.AnwarHossan-h4x
    @MD.AnwarHossan-h4x Рік тому

    Hi dear,
    I visited your channel. Your videos are very nice.
    But your video SEO score is low.

  • @JorgeDiz-s7j
    @JorgeDiz-s7j Рік тому

    divs are bad and old practices!

  • @twoplustwoequals5733
    @twoplustwoequals5733 Рік тому

    You're missing the point of the game, those shapes are so simple (usually: a square, a circle, a sphere, a line, a triangle etc), that it shouldn't be a challenge for a FrontEnd Dev just to make them lol, instead do this with th least code possible, that's where your brain really needs to start working ;)

  • @DavidLopez-n7q
    @DavidLopez-n7q 2 місяці тому

    6784 Champlin Motorway