Prevent Shrink
CSS
Hard
2 views
Problem Description
Make a badge that does not shrink next to a long title.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use flex-shrink: 0 on the badge.
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>
.row { display: flex; gap: 10px; align-items: center; width: 360px; border: 1px solid #eee; border-radius: 14px; padding: 12px; }
.badge { flex-shrink: 0; background: #0b5; color: #fff; padding: 4px 8px; border-radius: 999px; font-size: 12px; }
.title { min-width: 0; }
</style>
</head>
<body>
<div class='row'>
<span class='badge'>NEW</span>
<div class='title'>meetcode has many small coding questions for daily practice</div>
</div>
</body>
</html>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!