Skip to content

Instantly share code, notes, and snippets.

@julieahawkins
Last active August 24, 2017 16:47
Show Gist options
  • Save julieahawkins/fed9e9038ace028f54d1bbd95dc518e2 to your computer and use it in GitHub Desktop.
Save julieahawkins/fed9e9038ace028f54d1bbd95dc518e2 to your computer and use it in GitHub Desktop.
CSS Layout Challenges
Challenge 1

I added the element div3 and added float: right; to .div2 and .div3. position: relative; .div2 and .div3.

Challenge 1

Challenge 2

.div1 kept float: left;. I changed .div2 to float: center; margin: 0px auto; postion: relative; top: 100px; and .div2 to float: right; margin-top: 100px;.

Challenge 2

Challenge 3

.div1 margin: 0px auto;, expanded width and height, changed background color. .div2 just got margin: 25px auto;, I also nested the div2 inside div1.

Challenge 3

Challenge 4

.div2 received postion: absolute; with a top and right set to 50px and background-color changed to grey.

Challenge 4

Challenge 5

.div1 gets float: right; to force it to the right. .div2 gets margin: 0px auto; and position: relative; top: 100px; to put it in the middle and push it down. I added a .div3 which is floated left and a top margin of 100px to push it down

Challenge 5

Challenge 6

Gave .div1 grey background color and expanded the width and height to make a rectangle. float: right; and position: relative; added to top: 400px; to push it down. nested div2 and div3 inside div1. .div2 floated left and position absolute with top: 70px; to push it down. .div3 gets float right.

Challenge 6

Challenge 7

.div1 gets expanded height and width to 200px each. background color grey. removed float. nested .div2 inside .div1. .div2 gets float: left; position: relative; top: 100px; to stick it to the bottom left corner of .div1

Challenge 7

Challenge 8

same .div1 properties as challenge 7. removed the position relative and top on .div2. kept floated right.

Challenge 8

Challenge 9

gave .div1 a grey background, float: left;, changed height and width to make it a tall rectangle. nested div2 and div3 inside div1. .div2 and .div3 get margin: 0px auto; to center them and position relative to move them up or down. .div2 gets a value for bottom to push it upwards and .div3 gets a value for top to push it down

Challenge 9

Challenge 10

divs 2 and 3 are nested in div1. div1 gets expanded to a horizontal rectangle and given a grey color, it also gets margin: 50px auto. div2 and .div3 get position relative and display inline-block. div3 is floated right. div2 gets top: 35 and margin 0px auto and div3 just gets top:35 and right:35 to center it with div2.

Challenge 10

Challenge 11

Challenge 11

Challenge 12
Challenge 13
Challenge 14
Challenge 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment