CSS 2.1 §10.6.3 defines auto-height as the distance from the content top to the last in-flow child's margin-box bottom. Large negative margins can make this negative, which has no geometric meaning. Clamp to 0 to match browser behavior and fix Acid2 .empty div layout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
22 lines
278 B
HTML
22 lines
278 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<style>
|
|
.parent {
|
|
width: 200px;
|
|
background: red;
|
|
}
|
|
.child {
|
|
height: 50px;
|
|
margin-bottom: -100px;
|
|
background: green;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="parent">
|
|
<div class="child"></div>
|
|
</div>
|
|
</body>
|
|
</html>
|