Skip to content

Instantly share code, notes, and snippets.

@dstock48
Last active March 24, 2017 17:16
Show Gist options
  • Save dstock48/10f2cd0ccf5ad2b08bc422546bd1f587 to your computer and use it in GitHub Desktop.
Save dstock48/10f2cd0ccf5ad2b08bc422546bd1f587 to your computer and use it in GitHub Desktop.
css-layout-challenges

CSS Layout Challenges

I gave all of the div's a class of "box" and a class of 1 - 3, then I floated them all to the left. I put div's 2 and 3 inside a div container with the class "right" and floated that class to the right.


I left box 1 alone, gave box 2 a margin of auto, and gave box 3 a float right.


Box 1 is nested inside Box 2. I gave box 1 position: relative and box 2 position: absolute with a top and left offset of 100px because the containing box is 200px.


Box 1 is nested inside Box 2. I gave box 1 position: relative and box 2 position: absolute with a top and left offset of 50%.


Box 1 has float: right. Box 2 has clear: both to clear the float of the previous box, and has margin: auto to be centered. Box 3 was left alone.


Body has position: relative so that Box 1 can be absolutely positioned at the bottom right of the screen. Box 1 also acts as a container for Box 2 and 3 which are absolutely positioned at the bottom-left and top-right of Box 1.


Box 1 has position: relative. Box 2 is nested inside Box 1 and has position: aboslute with bottom: 0; right: 0;


Same as above, but with Box 2 having top: 0 instead of bottom: 0


Description


Description


Description


Description


Description


Description


Description

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