Created
July 29, 2013 17:52
-
-
Save dziudek/6106185 to your computer and use it in GitHub Desktop.
Text centered over the image
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
/** | |
* Text centered over the image | |
*/ | |
figure { | |
border: 1px solid red; | |
float: left; | |
position: relative; | |
} | |
img { | |
display: block; | |
} | |
figcaption { | |
position: absolute; | |
height: 100%; | |
width: 100%; | |
top: 0; | |
} | |
figcaption div { | |
border: 1px solid green; | |
display: table; | |
height: 100% | |
} | |
figcaption h1 { | |
display: table-cell; | |
vertical-align: middle; | |
} |
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
<figure> | |
<img src="http://placekitten.com/320/320" /> | |
<figcaption> | |
<div> | |
<h1>Lorem ipsum dolor sit amet</h1> | |
</div> | |
</figcaption> | |
</figure> |
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
// alert('Hello world!'); |
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-vertical","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