Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can use <strong><a href="https://devdocs.io/css/css_flexible_box_layout" rel="noreferrer">flexbox</a></strong> to lay out your items:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>#parent { display: flex; } #narrow { width: 200px; background: lightblue; /* Just so it's visible */ } #wide { flex: 1; /* Grow to rest of container */ background: lightgreen; /* Just so it's visible */ }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="parent"&gt; &lt;div id="wide"&gt;Wide (rest of width)&lt;/div&gt; &lt;div id="narrow"&gt;Narrow (200px)&lt;/div&gt; &lt;/div&gt;</code></pre> </div> </div> </p> <p>This is basically just scraping the surface of flexbox. Flexbox can do pretty amazing things.</p> <hr> <p>For older browser support, you can use CSS <strong>float</strong> and a <strong>width</strong> properties to solve it.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>#narrow { float: right; width: 200px; background: lightblue; } #wide { float: left; width: calc(100% - 200px); background: lightgreen; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="parent"&gt; &lt;div id="wide"&gt;Wide (rest of width)&lt;/div&gt; &lt;div id="narrow"&gt;Narrow (200px)&lt;/div&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
 

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