Print Friendly Page
CSS
Hard
3 views
Problem Description
Create a print style that hides nav and keeps text black.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use @media print rules.
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 { padding: 12px; background: #111; color: #fff; }
@media print {
nav { display: none; }
body { color: #000; }
}
</style>
</head>
<body>
<nav>meetcode menu</nav>
<main>
<h1>meetcode</h1>
<p>Print this page cleanly.</p>
</main>
</body>
</html>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!