Created
September 6, 2013 06:49
-
-
Save ramsesoriginal/6460348 to your computer and use it in GitHub Desktop.
Example for images with copyable code sample on click
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
/** | |
* Example for images with copyable code sample on click | |
*/ | |
*:focus { | |
outline: none; | |
} | |
figure { | |
box-sizing: border-box; | |
width: 440px; | |
height: 250px; | |
padding: 20px; | |
display: inline-block; | |
margin: 20px; | |
border: 1px solid #333; | |
color: #333; | |
background-color: #ccc; | |
position: relative; | |
z-index: 1; | |
} | |
figure figcaption { | |
box-sizing: border-box; | |
border: 1px solid #333; | |
background-color: white; | |
position: absolute; | |
top: 70px; | |
left: 0; | |
display: none; | |
z-index: 2; | |
width: 440px; | |
padding: 10px; | |
} | |
figure figcaption textarea { | |
width: 400px; | |
min-height: 200px; | |
display: block; | |
margin-left: auto; | |
margin-right: auto; | |
} | |
figure:focus figcaption { | |
display: block; | |
} | |
figure figcaption:hover { | |
display: block; | |
} |
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 class="codeImage" tabindex="-1"> | |
<img src="http://lorempixel.com/400/200/" /> | |
<figcaption> | |
Some sample code, maybe with some explaination: | |
<textarea> | |
# The Greeter class | |
class Greeter | |
def initialize(name) | |
@name = name.capitalize | |
end | |
def salute | |
puts "Hello #{@name}!" | |
end | |
end | |
# Create a new object | |
g = Greeter.new("world") | |
# Output "Hello World!" | |
g.salute | |
</textarea> | |
</figcaption> | |
</figure> | |
<figure class="codeImage" tabindex="-1"> | |
<img src="http://lorempixel.com/400/200/" /> | |
<figcaption> | |
Some other code smaple, maybe with some explaination: | |
<textarea> | |
# Output "I love Ruby" | |
say = "I love Ruby" | |
puts say | |
# Output "I *LOVE* RUBY" | |
say['love'] = "*love*" | |
puts say.upcase | |
# Output "I *love* Ruby" | |
# five times | |
5.times { puts say } | |
# Create a new object | |
g = Greeter.new("world") | |
# Output "Hello World!" | |
g.salute | |
</textarea> | |
</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":"separate","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment