Last active
August 29, 2015 14:04
-
-
Save clhenrick/9557d83410d67e1a6933 to your computer and use it in GitHub Desktop.
mfa dt bootcamp web class css positioning example 6: stretching block elements using position absolute & offset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- Credit:These positioning examples are credited to Noah Stokes' blog post on A List Apart, CSS positioning 101: http://alistapart.com/article/css-positioning-101 | |
--> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Boxes positioned absolute and streched out</title> | |
<style> | |
h1, h3 { | |
z-index: 10; | |
text-align: center; | |
} | |
div { | |
z-index: -9; | |
} | |
#box_1 { | |
position: absolute; | |
top: 10px; | |
right: 10px; | |
bottom: 10px; | |
left: 10px; | |
background: #44accf; | |
} | |
#box_2 { | |
position: absolute; | |
top: 20px; | |
right: 20px; | |
bottom: 20px; | |
left: 20px; | |
background: #ff9c34; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Two boxes positioned absolute and streched out</h1> | |
<h3>The blue box has top, right, bottom, left set to 10px</h3> | |
<h3>The orange box has top, right, bottom, left set to 20px</h3> | |
<div id="box_1"></div> | |
<div id="box_2"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment