Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Modernizr, use generated class or not ?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #38813
    aoeui
    Participant

    hi,

    starting with Modernizr
    http://codepen.io/krsiakdaniel/pen/9/7

    what is correct use to target older browsers, using the default generated class in HTML (example 1.]) ?

    Test border shadow

    /* 1.] uses HTML classes */
    .no-borderradius .box {border: 3px solid green;}
    .borderradius .box {
    -webkit-box-shadow: inset 0 0 5px #333;
    box-shadow: inset 0 0 5px #333;
    }

    /* 2.] but this works too */
    .box {border: 10px solid red;}
    .boxshadow .box {
    border: none;
    -webkit-box-shadow: inset 0 0 5px #333;
    box-shadow: inset 0 0 5px #333;
    }

    I noticed you can use only class .box for older IE
    then just override it in modern browsers, supporting this feature.boxshadow .box with border: none;

    which one of these is correct use?
    (I believe no.1)

    #105668
    Jeager
    Member

    I never got into using Modernizr, but for question 2, rather then just applying a border, you can actually have modernizr create the box shadow for the user using java instead of a fallback.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.