Wrap and Center
CSS
Medium
2 views
Problem Description
Create wrapped chips that stay centered when they go to next line.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use flex-wrap and justify-content: center.
Official Solution
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>meetcode</title>
<style>
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 360px; }
.chip { padding: 8px 10px; border: 1px solid #ddd; border-radius: 999px; }
</style>
</head>
<body>
<div class='chips'>
<span class='chip'>HTML</span>
<span class='chip'>CSS</span>
<span class='chip'>JavaScript</span>
<span class='chip'>Python</span>
<span class='chip'>PHP</span>
<span class='chip'>SQL</span>
</div>
</body>
</html>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!