Created
September 18, 2012 02:35
-
-
Save minitech/3740941 to your computer and use it in GitHub Desktop.
Fixed elements that have a right margin relative to a content element
This file contains hidden or 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
/** | |
* Fixed elements that have a right margin relative to a content element | |
* http://stackoverflow.com/q/12469476/707111 | |
*/ | |
html, body { | |
height: 100%; | |
margin: 0; | |
} | |
#button-wrapper { | |
bottom: 40px; | |
left: 50%; | |
margin-left: 350px; | |
position: fixed; | |
} | |
#button { | |
background-color: red; | |
padding: 5px; | |
position: absolute; | |
right: 10px; | |
white-space: nowrap; | |
} | |
#content { | |
margin: 0 auto; | |
width: 700px; | |
min-height: 100%; | |
background-color: #eee; | |
} |
This file contains hidden or 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
<div id="content">this is my page</div> | |
<div id="button-wrapper"> | |
<div id="button">magic button</div> | |
</div> |
This file contains hidden or 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
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment