Using only CSS and HTML, you can create a small USA flag with correct proportions and adjustable size through changing the main container's size in percentage using the code provided below. It uses CSS to style the flag without including any links, frameworks, or images.
Place the following code in your HTML file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>USA Flag</title>
<style>
.flag {
width: 100%;
position: relative;
padding-bottom: 52.63%; /* 10/19 of container's width */
background: #bf0a30;
}
.stripe {
width: 100%;
position: absolute;
box-sizing: border-box;
}
.stripe:nth-child(2n + 2) {
background: white;
}
.union {
position: absolute;
background: #3c3b6e;
width: 38.1029%;
padding-bottom: 76.950%; /* 7/13 of union's width */
clip-path: polygon(0% 0%, 100% 0%, 100% 53.8462%, 76.993% 26.923%, 0% 53.846%);
}
.star {
display: inline-block;
/* The unicode character for a white star */
content: "☆";
text-align: center;
color: white;
font-size: 1.03794%; /* Using 4/3.85714 % of the union's width */
width: 7.692%; /* 1/13 of union's width */
height: 11.11%; /* 1/9 of union's height */
line-height: 2.9566%; /* 2/67 of union's width */
position: absolute;
}
.row1 .star:nth-child(2n + 2) {
margin-left: 3.846%; /* 1/26 of union's width */
}
.row2 .star {
top: 11.11%;
}
.row3 .star {
top: 22.22%;
}
.row4 .star {
top: 33.333%;
}
.row4 .star:nth-child(2n + 2) {
margin-left: 3.846%;
}
.row5 .star {
top: 44.444%;
}
.row6 .star {
top: 55.555%;
}
.row6 .star:nth-child(2n + 2) {
margin-left: 3.846%;
}
</style>
</head>
<body>
<div class="flag" style="width: 25%;"> <!-- Change the width percentage value to adjust flag size -->
<div class="union">
<div class="row1">
<span class="star">☆</span><span class="star">☆</span><span class="star">☆</span><span class="star">☆</span><span class="star">☆</span>
</div>
<div class="row2">
<span class="star">☆</span><span class="star">☆</span><span class="star">☆</span><span class="star">☆</span><span class="star">☆</span>
</div>
<div class="row3">
<span class="star">☆</span><span class="star">☆</span><span class="star">☆</span><span class="star">☆</span><span class="star">☆</span>
</div>
<div class="row4">
<span class="star">☆</span><span class="star">☆</span><span class="star">☆</span><span class="star">☆</span><span class="star">☆</span>
</div>
<div class="row5">
<span class="star">☆</span><span class="star">☆</span><span class="star">☆</span><span class="star">☆</span><span class="star">☆</span>
</div>
<div class="row6">
<span class="star">☆</span><span class="star">☆</span><span class="star">☆</span><span class="star">☆</span><span class="star">☆</span>
</div>
</div>
<div class="stripe" style="height: 5.3%;"></div>
<div class="stripe" style="height: 5.3%; top: 10.6%;"></div>
<div class="stripe" style="height: 5.3%; top: 21.2%;"></div>
<div class="stripe" style="height: 5.3%; top: 31.8%;"></div>
<div class="stripe" style="height: 5.3%; top: 42.4%;"></div>
<div class="stripe" style="height: 5.3%; top: 53%;"></div>
<div class="stripe" style="height: 5.3%; top: 63.6%;"></div>
<div class="stripe" style="height: 5.3%; top: 74.2%;"></div>
<div class="stripe" style="height: 5.3%; top: 84.8%;"></div>
<div class="stripe" style="height: 5.3%; top: 95.4%;"></div>
</div>
</body>
</html>
Simply change the width percentage value in the "flag" div element to adjust the flag's overall size.