Edit in JSFiddle

<h3>Detect Video Formats with Modernizr tests (only CSS control)<br/>
<a href="www.aureliomerenda.com/detect-video-formats-support-modernizr-tests/">www.aureliomerenda.com/detect-video-formats-support-modernizr-tests/</a></h3>
<br/>
<p class="ogg ok">Your browser support OGG</p>
<p class="ogg no">Your browser don't support OGG</p>

<p class="h264 ok">Your browser support H264</p>
<p class="h264 no">Your browser don't support H264</p>

<p class="webm ok">Your browser support WEBM</p>
<p class="webm no">Your browser don't support WEBM</p>
.ok, .no {
    display: none;
    padding: 2px;
}

.ok {
    background-color: #7DF481;
}

.no {
    background-color: #FE8484;
}

HTML.videoogg .ogg.ok { display: block; }
HTML.no-videoogg .ogg.no { display: block; }

HTML.videoh264 .h264.ok { display: block; }
HTML.no-videoh264 .h264.no { display: block; }

HTML.videowebm .webm.ok { display: block; }
HTML.no-videowebm .webm.no { display: block; }
/****** MODERNIZR TEST *******/

Modernizr.addTest('videoogg', function(){
     var elem = document.createElement('video'),
          bool = false;
     try {
          bool = !!elem.canPlayType;
          if ( bool ) {
               bool = new Boolean(bool);
               bool.ogg = elem.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,'');
               if(bool.ogg == "maybe" || bool.ogg == "probably"){
                    bool = true;
               } else {
                    bool = false;
               }
          }
     } catch(e) { }
     return bool;
});


Modernizr.addTest('videoh264', function(){
     var elem = document.createElement('video'),
          bool = false;
     try {
          bool = !!elem.canPlayType;
          if ( bool ) {
               bool = new Boolean(bool);
               bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,'');
               if(bool.h264 == "maybe" || bool.h264 == "probably"){
                    bool = true;
               } else {
                    bool = false;
               }
          }
     } catch(e) { }
      return bool;
});


Modernizr.addTest('videowebm', function(){
     var elem = document.createElement('video'),
          bool = false;
      try {
          bool = !!elem.canPlayType;
          if ( bool ) {
               bool = new Boolean(bool);
               bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
               if(bool.webm == "maybe" || bool.webm == "probably"){
                    bool = true;
               } else {
                    bool = false;
               }
          }
     } catch(e) { }
      return bool;
});