I am trying to recreate Ethopia flag using HTML and CSS but I am unable to do the middle part of the flag. The star inside the circle is not coming as expected. HTML and CSS I have applied:

body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f0f0f0; } .flag { width: 450px; height: 300px; position: relative; /* Green, Yellow, Red stripes using linear gradient */ background: linear-gradient( to bottom, #078900 0%, /* Green */ #078900 33.33%, #fddc12 33.33%, /* Yellow */ #fddc12 66.66%, #e4032d 66.66%, /* Red */ #e4032d 100% ); border: 1px solid #333; } .emblem { /* Position and size of the emblem container */ position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40%; height: 40%; } /* Ensures the SVG scales correctly within the .emblem container */ .emblem svg { width: 100%; height: 100%; display: block; } <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Accurate Ethiopian Flag</title> </head> <body> <div class="flag"> <div class="emblem"> <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <circle cx="50" cy="50" r="48" fill="#03459c"/> <g fill="#fddc12"> <rect x="49" y="5" width="2" height="90" transform="rotate(0 50 50)"/> <rect x="49" y="5" width="2" height="90" transform="rotate(45 50 50)"/> <rect x="49" y="5" width="2" height="90" transform="rotate(90 50 50)"/> <rect x="49" y="5" width="2" height="90" transform="rotate(135 50 50)"/> </g> <polygon points="50,25 56.6,43.3 75,43.3 59.2,54 65.8,72.3 50,61.6 34.2,72.3 40.8,54 25,43.3 43.4,43.3" fill="#fddc12" /> <polygon points="50,25 56.6,43.3 75,43.3 59.2,54 65.8,72.3 50,61.6 34.2,72.3 40.8,54 25,43.3 43.4,43.3" fill="none" stroke="#fddc12" stroke-width="1.5" /> </svg> </div> </div> </body> </html>

My output:

enter image description here

Expected output:

enter image description here

Anitha Kode's user avatar

New contributor

Anitha Kode is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.