Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I write HTML and CSS for this solution. I don't use table layout, float: right or position: absolute.</p> <h1>HTML</h1> <pre><code>&lt;h1&gt;Example 1&lt;/h1&gt; &lt;div class="tiles"&gt; &lt;div class="tile tile--one"&gt;1&lt;/div&gt; &lt;div class="tile tile--two"&gt;2&lt;/div&gt; &lt;div class="tile tile--one title--modified"&gt;3&lt;/div&gt; &lt;/div&gt; &lt;h1&gt;Example 2&lt;/h1&gt; &lt;div class="tiles"&gt; &lt;div class="tile tile--one"&gt;1&lt;/div&gt; &lt;div class="tile tile--two"&gt;2&lt;/div&gt; &lt;div class="tile tile--one title--modified"&gt;3&lt;/div&gt; &lt;div class="tile tile--two"&gt;2&lt;/div&gt; &lt;div class="tile tile--one"&gt;1&lt;/div&gt; &lt;div class="tile tile--two"&gt;2&lt;/div&gt; &lt;div class="tile tile--one title--modified"&gt;3&lt;/div&gt; &lt;/div&gt; </code></pre> <h1>CSS</h1> <pre><code>*, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } h1 { margin: 40px 0; } .tiles { width: 400px; overflow: hidden; } .tile { text-align: center; float: left; border: 1px solid #f0f0f0; } .tile--one { background-color: rgba(255, 20, 20, .6); width: 200px; height: 100px; } .tile--two { background-color: rgba(20, 20, 255, .6); width: 200px; height: 200px; } .title--modified { margin-top: -100px; } </code></pre> <p>I hope it can help you. This is demo</p> <p><img src="https://i.stack.imgur.com/NOPu6.jpg" alt="Prevent Float Div"></p> <h1><a href="http://dabblet.com/gist/6183137" rel="nofollow noreferrer">Demo</a></h1>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload