Celebrating 75th Independence day of India in a coder way
Published: 2021-08-13 08:29:20

Hello, Mate! 😃👋 Hope you are doing great! <br/>This year will be a special year for India as we will be celebrating the 75th Independence day of India on 15th August 2021. Since the day would be special, why not we (developers) make it even more special by celebrating it in a developer way. 💻 

Yes, you got it correct! We are going to create our National Flag using pure HTML & CSS. ✏️📗

This idea 💡 suddenly struck into my mind 🧠 when I was listening 🎵 to some patriotic songs and going through the news and articles about different forms of celebration. 🎉

So, without any further delay, let's open the code editor (I prefer visual studio code - my fav 😛) and directly jump into the code.

Let's write some HTML code to prepare the skeleton and then we will add colors
to it. Sounds cool? let's get started...



- Create a file with the name: flag.html (or anything of your own choice)

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628793067898/fdDJD5Sbt.png)

- First, create the basic structure of the webpage with basic HTML tags.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628796339094/px8_aQIQk.png)
- Within the body tag, create an outer div with id, let's say, flag
- Within the outer div, create another div with id as saffron (It will look like the below image)

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628793292912/7fNmXWOpX.png)

- Since we have white color in the middle of the flag followed by saffron, let's create a div for the white area.


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628793424634/Yd2HTyp6B.png)

- We also have Ashok Chakra in the middle, let's build it.
- Create a div with id as wheel within the div with id as white. The code would look like: 

```<div id="flag"> 
    <div id="saffron"></div>
    <div id="white">
        <div id="wheel"></div>
    </div>
</div>```
- Within the div with the id as wheel, create twelve(12) divs with id as spoke*n (where n is from 1 to 12) for spokes --> Mathematical calc: Half of the count of spokes in Ashok Chakra i.e. 24/2 = 12.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628794570372/vTccdULBa.png)
- Now, after the closing div for white, create another div with id as green. The code would look like this:

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628795047882/baD8tydlC.png)
- With this, you are 100% done with the skeleton implementation. The final HTML file would look like this:

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628796447148/7qNqYJSGw.png)
- Now, it's time to add colors to our beautiful flag.

- Create another file with the name: flag_style.css
- Let's start with the outer div: Add #flag selector and within that, write the following code:

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628795294399/AT8Hs3b92.png)
- Now, it's time to add styling to the div with the id as saffron

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628795367098/dGK9nMme1T.png)
- Similarly, we need to do it for other divs: white and green

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628795448124/BtYB2VVaf.png)
- Once you are done with all the above-mentioned styling, add styling to the wheel
 

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628795547943/2N6BQa0Qo.png)
- Now, we are left with the last part: adding styling to the spokes on the wheel.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628795704368/hM70jOGxD.png)
- Let's add some more lively effects to the wheel, making it move.
- For this, we have a CSS property: transform with rotate. We would make us of this.
- For all the twelve(12) spokes, add the CSS property: transform with rotate having a difference of 15 degrees. The code would look like this:

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628796000989/KDhRGjSyB.png)
- In order to support the rotation movement effect across all the different web browsers we have, we need to make use of the CSS WebKit. 

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628796107745/h39-NgQuQ.png)
- The last and the very interesting part of this is to link the HTML with the styles that we have added.
- We need to add a link tag within the head tag with rel="text/stylesheet" and href="./flag_style.css".
```<link rel="stylesheet" href="./flag_style.css" />```

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628796679169/MZtjl7uaQ.png)

It's time to test out your efforts to see how the BIG PICTURE is looking.
- Right-click on the space area and select `open with live server` ( If not present, you need to install LiveServer VS Code extension)

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628796836733/vXYLEj98d.png)
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1628796746957/siGHqVMtj.png)

The final preview would look like this:

[Final Result](https://codepen.io/paurush2508/full/bGWZgqm)

<blockquote>JAI HIND! ❤️️🇮🇳 JAI BHARAT! ❤️️🇮🇳 </blockquote>

Connect with me: [Tech Blog](https://blog.paurush.dev)

Want to know more about me? [Check this out](https://paurush.dev)