Multiple Classes Selector
CSS
Medium
4 views
Problem Description
Style a button only when it has both classes: .btn.primary.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use a combined class selector.
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>
.btn { padding: 10px 14px; border-radius: 12px; border: 1px solid #ddd; background: #fff; }
.btn.primary { background: #0b5; border-color: #0b5; color: #fff; }
</style>
</head>
<body>
<button class='btn' type='button'>Normal</button>
<button class='btn primary' type='button'>Primary</button>
</body>
</html>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!