I have repeatedly encountered this problem and have not yet found a solution.
Example 1 : http://jsfiddle.net/0f5u0w6e/1/
What does it look like:

What it should look like:

In this example, divs should behave like strings, but that's more than that: I want divs or span to be bounding fields for all of their contents. (Then it is also impossible for some of their contents to push parts of other divs.)
Example 2 : http://jsfiddle.net/gd7Losru/1/
I want the inner (red) spacing so that the outer (blue) div is so high that it contains it. (again: bounding box).
copy code if jsFiddle is disabled: Example 1:
<div style="width: 200px;"> <div> Title Title Title <span class="button" style="float: right; padding: 10px;"> button</span> </div> <div> Config: <input type="text" /> </div> </div>
Example 2:
<div style="background-color: blue;"> <span style="padding: 10px; background-color:red; "></span> </div>
html css
ben
source share