Frontendplace Blog

Sharing Frontend developing ideas

Archive for November, 2013

Media queries mixing

Posted by info on 16th November 2013

Here are some examples of media query mixins i use to generate the media queries needed for different viewport sizes:

@mixin respond-min($width) {
    // If we're outputting for a fixed media query set...
    @if $fixViewport {
        // ...and if we should apply these rules...
        @if $fixViewport >= $width {
            // ...output the content the user gave us.
            @content;
        }
    }
    @else {
        // Otherwise, output it using a regular media query
        @media screen and (min-width: $width) {
            @content;
        }
    }
}

@mixin respond-max($width) {
    // If we're outputting for a fixed media query set...
    @if $fixViewport {
        // ...and if we should apply these rules...
        @if $fixViewport < $width {
            // ...output the content the user gave us.
            @content;
        }
    }
    @else {
        // Otherwise, output it using a regular media query
        @media screen and (max-width: $width) {
            @content;
        }
    }
}

// mixins Styles for Old IE:

$oldIE: false !default;

@mixin oldIE {
    // Only use this content if we're dealing with old IE
    @if $oldIE {
        @content;
    }
}

// Only use this content if we're NOT dealing with old IE
@mixin modern{
    @if $oldIE == false{
        @content;
    }
}

Posted in 3D Tutorials | Comments Off

Sass mixin for webfont embedding

Posted by info on 16th November 2013

// example @include webfont("MyFontname-Regular","fonts","myfontname-regular","italic","300");
@mixin webfont($font-family,$font-url,$font-name,$style: normal, $weight: normal){  
    @font-face {

        font: {
                family: $font-family;
                style: unquote($style);
                weight:  unquote($weight);
            }
        src: url($font-url + '/' + $font-name + '.eot'); //IE9
        src: url($font-url + '/' + $font-name + '.eot?#iefix') format("embedded-opentype"), //IE6-8
             url($font-url + '/' + $font-name + '.woff') format("woff"), // modern browsers
             url($font-url + '/' + $font-name + '.ttf') format("truetype")  // safari android ios
             url($font-url + '/' + $font-name + '.svg#' + $font-name) format("svg"); //legacy ios
    }
}

Posted in Scripting | Comments Off

Hgroup obsolete

Posted by info on 16th November 2013

For those that have not yet seen the update for obsolete elements for the HTML5 specs. The hgroup we just starting to use is already obsolete. see:

Posted in Scripting | Comments Off