Scrollable Box
CSS
Medium
2 views
Problem Description
Create a box with max-height and show a scrollbar when content is long.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use max-height and overflow: auto.
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>
.log { max-height: 120px; overflow: auto; border: 1px solid #eee; border-radius: 12px; padding: 12px; width: 360px; }
</style>
</head>
<body>
<div class='log'>
<p>meetcode update 1</p>
<p>meetcode update 2</p>
<p>meetcode update 3</p>
<p>meetcode update 4</p>
<p>meetcode update 5</p>
<p>meetcode update 6</p>
</div>
</body>
</html>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!