Skip to content

Instantly share code, notes, and snippets.

@netsi1964
Created June 22, 2012 12:50
Show Gist options
  • Save netsi1964/2972575 to your computer and use it in GitHub Desktop.
Save netsi1964/2972575 to your computer and use it in GitHub Desktop.
Playing around with CSS3- building a quote feature
<html>
<head>
<title>Playing around with CSS3- building a quote feature</title>
<meta charset="utf-8" />
<style type="text/css">
.quote {
background-color: rgba(0, 0, 0, 0.1);
font-size: 140%;
margin: 13px;
padding: 15px;
text-align: center;
vertical-align: middle;
width: 25%;
}
.quote:focus {outline: dashed 3px red;}
.quote:before, .quote:after {
content: "„";
font-size: 160%;
font-weight: bold;
line-height: 48%;
padding: 4px;
position: relative;
top: -10%;
z-index: 10;
}
.quote:before {content: "“";bottom: -10%;}
.blue {background-color: rgba(0,0,100,.2);}
.small {font-size: 75%;}
.marked {background-color: rgba(200,190,0,.8); padding: 0px 5px;}
.crossed {background-image: -webkit-linear-gradient(-45deg, transparent 25%, rgba(255,0,0,.8) 25%, rgba(255,0,0,.8) 50%, transparent 50%, transparent 75%, rgba(255,0,0,.8) 75%, rgba(255,0,0,.8));
background-image: -moz-linear-gradient(-45deg, transparent 25%, rgba(255,0,0,.8) 25%, rgba(255,0,0,.8) 50%, transparent 50%, transparent 75%, rgba(255,0,0,.8) 75%, rgba(255,0,0,.8));
background-image: -o-linear-gradient(-45deg, transparent 25%, rgba(255,0,0,.8) 25%, rgba(255,0,0,.8) 50%, transparent 50%, transparent 75%, rgba(255,0,0,.8) 75%, rgba(255,0,0,.8));
background-image: -ms-linear-gradient(-45deg, transparent 25%, rgba(255,0,0,.8) 25%, rgba(255,0,0,.8) 50%, transparent 50%, transparent 75%, rgba(255,0,0,.8) 75%, rgba(255,0,0,.8));
background-image: linear-gradient(-45deg, transparent 25%, rgba(255,0,0,.8) 25%, rgba(255,0,0,.8) 50%, transparent 50%, transparent 75%, rgba(255,0,0,.8) 75%, rgba(255,0,0,.8));
background-size:50px 50px}
.shadow {
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
}
.round {
border-radius: 4px 4px 4px 4px;
}
.wide {width: 50%;}
.notSelectable {-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;}
/* Not related to job */
.classes {color: black; font-size: 12px; font-family: monospace; clear: both; display: inline-block; padding: 5px; background-color: #eee; border-radius: 5px;}
.classes:before {content: "Classes: .";}
</style>
</head>
<body>
<h1>Playing around with CSS3- building a quote feature</h1>
<div class="quote">This is a quote</div>
<div class="quote round shadow crossed notSelectable" contenteditable="true">You may edit me...</div>
<div class="quote round shadow notSelectable" contenteditable="false">You may <strong>NOT</strong>edit me...<br>..or even select my content!</div>
<div class="quote blue small shadow">
Lorem ipsum dolor <strong>sit amet</strong>
, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodopre
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
<pre>code inline using pre</pre>
cillum dolore eu
<span class="marked">fugiat nulla pariatur</span>
. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<div class="quote crossed round">
Lorem ipsum dolor <strong>sit amet</strong>
, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodopre
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
<pre>code inline using pre</pre>
cillum dolore eu
<span class="marked">fugiat nulla pariatur</span>
. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
window.jQuery || document.write('<script src="jquery.1.7.2.min.js">\x3C/script>');</script>
<script type="text/javascript">
(function($, window, undefined) {
// Your code here, put just above /body
// $ = jQuery
$('.quote').each(function(i) {
var $this = $(this).attr('tabindex',i);
$this.append('<span class="classes shadow">'+$this.attr('class').split(' ').join(' .')+'</span>');
});
})(jQuery, window);
</script>
<small>http://jsfiddle.net/gh/gist/jquery/1.7.2/2972575/</small>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment