Direct Child Selector
CSS
Medium
2 views
Problem Description
Style only the direct list items inside a menu using > selector.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use nav > ul > li to show direct child selection.
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>
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>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!