1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34

content / test / data / accessibility / html / micro-clearfix-hack.html [blame]

<!DOCTYPE html>
<!--
http://nicolasgallagher.com/micro-clearfix-hack/
"The clearfix hack is a popular way to contain floats without resorting to using
presentational markup."
Goal: avoid extra spaces added to the output for this, e.g. NVDA reading "blank".
-->
<html>
<head>
<style>
.cf::before, .cf::after {
  content: " ";
  display: table;
}
.cf::after { clear: both; }

.cf { background: lightgray; }
.float {
  float: left;
  padding: 5px;
  background: beige;
}
</style>
</head>
<body>

<h1>Micro clearfix demo</h1>
<div class="cf">
  <div class="float">Float#1</div>
  <div class="float">Float#2</div>
</div>
<h2>End of demo</h2>
</body>
</html>