Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>The title of the document</title> <style> .red-container { height: 30vh; border: 2px solid #f45e30; color: #f45e30; } .blue-container { height: 40%; width: 30%; border: 2px solid #1c87c9; color: #1c87c9; margin-top: 20px; } .orange-container { height: 100px; border: 2px solid #f9fc35; color: #f9fc35; margin-top: 20px; } .green-container { height: auto; border: 2px solid #8ebf42; color: #8ebf42; margin-top: 20px; } </style> </head> <body> <h2>Height property example</h2> <div class="red-container"> Height 30vh <div class="blue-container"> Height 40% </div> </div> <div class="orange-container"> Height 100px; </div> <div class="green-container"> Height (auto) </div> </body> </html>