<!doctype html>
<head>
<style>
body {
font-family: Arial;
}
span {
display: inline;
}
.block {
display: inline-block;
padding: 5px;
margin: 5px;
border: 1px solid red;
}
</style>
</head>
<body>
<div class="block">A</div>
<span>
<div class="block">A</div>
<span>
<div class="block">A</div>
<span>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</span>
<div class="block">B</div>
</span>
<div class="block">B</div>
</span>
<div class="block">B</div>
</body>