Skip to content

Instantly share code, notes, and snippets.

@carlwood
Last active August 29, 2015 13:56
Show Gist options
  • Save carlwood/9229535 to your computer and use it in GitHub Desktop.
Save carlwood/9229535 to your computer and use it in GitHub Desktop.
Floating without widths

I was having a problem with floating two element - both left - hoping that the second element's width would expand to the end.

Original code:

.left { float: left; {
.right { float: left; } // right does not expand to fit the width of the row

Fix:

.left { float: left; }
.right { overflow: hidden; }

jsfiddle.net link here

Reference: http://stackoverflow.com/questions/1260122/expand-div-to-take-remaining-width

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment