Direct Child Selector

Direct Child Selector

Medium CSS CSS Foundations 33 views
Explanation Complexity

Problem Statement

Style only the direct list items inside a menu using > selector.

Input Format

No input.

Output Format

Print the HTML+CSS code in one block.

Constraints

Use nav > ul > li to show direct child selection.

Input / Output Format

Input Format
No input.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use nav > ul > li to show direct child selection.

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>
    nav > ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 12px; }
    nav > ul > li { padding: 6px 10px; border: 1px solid #eee; border-radius: 12px; }
  </style>
</head>
<body>
  <nav>
    <ul>
      <li>Home</li>
      <li>Topics</li>
      <li>Login</li>
    </ul>
  </nav>
</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>
    nav > ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 12px; }
    nav > ul > li { padding: 6px 10px; border: 1px solid #eee; border-radius: 12px; }
  </style>
</head>
<body>
  <nav>
    <ul>
      <li>Home</li>
      <li>Topics</li>
      <li>Login</li>
    </ul>
  </nav>
</body>
</html>
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.