Skip to content

Instantly share code, notes, and snippets.

$('input').keypress(function(event){
var enterOkClass = $(this).attr('class');
if (event.which == 13 && enterOkClass != 'enterSubmit') {
event.preventDefault();
return false;
}
});
@jmc2082
jmc2082 / gist:8842da13304a750b2e4cbd3ff95eb9d5
Created April 22, 2016 17:31
Less / CSS aspect ratio on an html element
// aspect ratio
.try-aspect(@width, @height) {
position: relative;
&:before {
display: block;
content: "";
width: 100%;
padding-top: (@height / @width) * 100%;
}
> .content {
@jmc2082
jmc2082 / gist:7aab851e770d84c172e7dc395965159a
Created May 13, 2016 12:48
Center UL List and "LI" items by displaying them like table cells
ul {
display: table;
table-layout: fixed;
margin: 0;
padding: 0;
li {
display: table-cell;
}
}
#circle {
width: 100px;
height: 100px;
background: red;
-moz-border-radius: 50px;
-webkit-border-radius: 50px;
border-radius: 50px;
}
.ellipsis {
text-overflow: ellipsis;
/* Required for text-overflow to do anything */
white-space: nowrap;
overflow: hidden;
}