Skip to content

Instantly share code, notes, and snippets.

View data-enhanced's full-sized avatar

David Cochran data-enhanced

View GitHub Profile
@data-enhanced
data-enhanced / gist:a2f804576dbc253700fb
Created September 29, 2014 15:54
SVG with PNG fallback -- from Alexey Ten and CSS Tricks
<svg width="96" height="96">
<image xlink:href="svg.svg" src="svg.png" width="96" height="96" />
</svg>
<!--
by Alexey Ten
http://lynn.ru/examples/svg/en.html
Exploits the way browsers render the image tag. Widely supported, including all major browsers.
@data-enhanced
data-enhanced / gist:3a7c980bec460c8139a2
Created June 9, 2015 18:11
WP Post Excerpt -- only if an excerpt is entered
<?php if ( !empty( $post->post_excerpt ) ) : // if the excerpt field is not empty
the_excerpt(); // do the excerpt
else : // if the excerpt field is empty
false; // no excerpt
endif; ?>
<!-- see: https://wordpress.org/support/topic/if-the_excerpt-is-blank -->
@data-enhanced
data-enhanced / html5-body-structure.html
Last active December 14, 2015 02:29
Basic structural tags for the body of an html5 document Includes the new <main> tag! Based on HTML5 Bones http://html5bones.com/
<!--
* Basic structural tags for the body of an html5 document
* Based on HTML5 Bones http://html5bones.com/
-->
<header role="banner">
<h1>Main Title</h1>
<nav role="navigation">
<ul>
<li><a href="index.html">Home</a></li>
@data-enhanced
data-enhanced / shadows.less
Last active December 14, 2015 04:49
Box and Text-Shadow -- Some Favorite LESS Variables
// Box Shadows
// ------------------------
@box-shadow-lighter: 0 0 2px hsla(0, 0%, 50%, 0.2);
@box-shadow-normal: 0 0 2px hsla(0, 0%, 50%, 0.3);
@box-shadow-darker: 0 0 2px hsla(0, 0%, 50%, 0.3);
@box-shadow-darkest: 0 0 2px hsla(0, 0%, 50%, 0.3);
// Down
@box-shadow-down-lighter: 0 1px 1px hsla(0, 0%, 50%, 0.2);
@data-enhanced
data-enhanced / mixins-gradients-hsla.less
Created February 25, 2013 15:42
Uses HSLa background-image to place a semi-transparent gradient over the top of any background color.
// Gradient Mixins
// ==============================
// HSLa Gradients
// Lays an HSLa alpha-transparency layer over top of any background color
// http://www.w3.org/TR/2003/CR-css3-color-20030514/#hsl-color
// http://css-tricks.com/yay-for-hsla/
// Be sure to use background-image NOT background,
// to specify the gradient as the image ONLY, atop the underlying color
//
@data-enhanced
data-enhanced / social-icons.less
Created February 26, 2013 22:45
Markup and LESS styles for social icons with round backgrounds, using Font Awesome plus gradient and shadow variables I've setup and shared in other gists.
// Social Icons with round backgrounds, using Font Awesome plus gradient and shadow variables I've setup and shared in other gists.
// Works with this markup:
<ul class="social">
<li><a class="twitter" href="#" title="Twitter Profile"><i class="icon-twitter"></i></a></li>
<li><a class="facebook" href="#" title="Facebook Page"><i class="icon-facebook"></i></a></li>
<li><a class="linkedin" href="#" title="LinkedIn Profile"><i class="icon-linkedin"></i></a></li>
<li><a class="googleplus" href="#" title="Google+ Profile"><i class="icon-google-plus"></i></a></li>
<li><a class="github" href="#" title="GitHub Profile"><i class="icon-github-alt"></i></a></li>
</ul>
@data-enhanced
data-enhanced / wp-related-stories.php
Created February 28, 2013 00:42
WP Query Related Posts - Custom Post Type
@data-enhanced
data-enhanced / grid-inline-table.less
Created May 2, 2013 16:53
LESS to display a products grid that can dynamically adjust the number of products per row, while keeping each row the height of the tallest product div. Using CSS 2 display: inline-table. Compatible with IE8 and better browsers.
//
// Products Grid
// --------------------------------------------------
@media screen and (min-width: @tablet-min-width) {
.products-grid {
display: table;
.product-item {
display: inline-table;
width: 46%;
@data-enhanced
data-enhanced / inline-table.css
Created May 15, 2013 19:03
Grid of items using inline-table to handle items of various heights by keeping each row the height of the tallest item
.products-grid {
display: table;
}
.product-item {
display: inline-table;
vertical-align: top; // needed by Safari
width: 46%;
margin-left: 2%;
}