Why isn't Modernizr working for me?

后端 未结 2 1503
自闭症患者
自闭症患者 2020-12-10 08:23

I don\'t think modernizr likes me, can someone please tell me what i\'m doing wrong. I can\'t seem to get modernizr to work on firefox, ie etc... I\'m only using elements li

相关标签:
2条回答
  • 2020-12-10 09:10

    You probably are forgetting to style the new HTML5 elements as block-level elements. By default, browsers treat any unknown element as an inline element (display:inline) which makes it difficult to do much with them.

    Newer browsers are slowly treating the new HTML5 elements as stable, meaning they start giving them default styling like display:block for the header element, for instance. But, most browsers on the market today don’t have those default styles for HTML5 elements, so you’ll need to provide them.

    Here’s a quick sample bit of CSS to do that:

    article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
      display: block;
    }
    

    Adding that CSS to your main.css should fix your styling issue.

    0 讨论(0)
  • 2020-12-10 09:14

    I had the same issue when I was trying to use a CDN and it wasn't working (I might have had the wrong link). The test I found was to put

    .borderradius body {
      background: #c00;
    }
    

    in your main.css and see if the background turns red. If it is modernizr, is working.

    EDIT: I've also found that the script must be inserted at the top of the HTML document. Putting it at the bottom, as suggested for better loading speed of pages, doesn't work.

    0 讨论(0)
提交回复
热议问题