Flex Card Footer Push

Flex Card Footer Push

Hard CSS Flexbox Layout 31 views
Explanation Complexity

Problem Statement

Inside a card, push the button to bottom using flex column and margin-top auto.

Input Format

No input.

Output Format

Print the HTML+CSS code in one block.

Constraints

Use display flex on card and margin-top: auto on button row.

Input / Output Format

Input Format
No input.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use display flex on card and margin-top: auto on button row.

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>
    .card { width: 320px; border: 1px solid #eee; border-radius: 14px; padding: 14px; display: flex; flex-direction: column; min-height: 180px; }
    .actions { margin-top: auto; }
    button { padding: 10px 12px; border-radius: 12px; border: 0; background: #0b5; color: #fff; }
  </style>
</head>
<body>
  <div class='card'>
    <h2>meetcode</h2>
    <p>Short card content.</p>
    <div class='actions'>
      <button type='button'>Start</button>
    </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>
    .card { width: 320px; border: 1px solid #eee; border-radius: 14px; padding: 14px; display: flex; flex-direction: column; min-height: 180px; }
    .actions { margin-top: auto; }
    button { padding: 10px 12px; border-radius: 12px; border: 0; background: #0b5; color: #fff; }
  </style>
</head>
<body>
  <div class='card'>
    <h2>meetcode</h2>
    <p>Short card content.</p>
    <div class='actions'>
      <button type='button'>Start</button>
    </div>
  </div>
</body>
</html>
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.