CSS Battle #123 - Snake

0 %
Manoj Kumar
Freelance Web Developer
"One Is All, All Is One"
  • City:
    Chennai
  • Country:
    India
  • Age:
    27
Lifetime score board
Shows
Music
Games
Current Interest Levels
Web Development
Cricket
Chess
Fitness
Movies & TV Series
Cooking
Trading
Cybersecurity
  • Ambivert
  • Nocturnal
  • Gym Junkie
  • Tech Enthusiast
  • Teetotalism

#123 – Snake

August 26, 2022
Well, the standard game on every old Nokia mobile. On first glance, I thought of using CSS Grid for this using grid-template-areas but not sure why I felt like flexbox looked like a good way for me.

<div a>
  <div a1></div>
  <div a2>
    <div c></div>
    <div c></div>
    <div c></div>
    <div c></div>
    <div c></div>
  </div>
</div>

<style>
  body {
    background: #C74E4E;
  }

  [a] {
    display: flex;
    justify-content: space-between;
    width: 220px;
    transform: translate(82px,82px);
  }

  [a1] {
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
  }

  [a2] {
    display: flex;
    gap: 5px;
  }

  [c] {
    width: 20px;
    height: 20px;
    background: #E0E246;
    border-radius: 5px;
  }
</style>

Posted in CSS Battle
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x