Prevent Shrink

Prevent Shrink

Hard CSS Flexbox Layout 23 views
Explanation Complexity

Problem Statement

Make a badge that does not shrink next to a long title.

Input Format

No input.

Output Format

Print the HTML+CSS code in one block.

Constraints

Use flex-shrink: 0 on the badge.

Input / Output Format

Input Format
No input.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use flex-shrink: 0 on the badge.

Examples

Input:
Output:
(HTML+CSS code)

Example Solution (Public)

CSS
<!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>

Official Solution Code

<!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>
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.