Padding not working when using
tag in IE

前端 未结 3 2114
一生所求
一生所求 2021-02-04 19:07

I am using HTML5 < section > tag in my application, padding for < section > tag works fine in chrome,ff and safari but its not working in IE..

I tried adding displ

3条回答
  •  无人及你
    2021-02-04 19:48

    Many older browsers don't understand HTML5 tags like section and use the fallback of treating them as inline items in the flow of the document.

    IE goes a step beyond this and totally ignores HTML5 tags. To fix this, you'll need to add the tags to the document via Javascript. Fortunately, there's a very nice HTML5Shiv that you can embed in the head of your html like so:

         
        
    
         
    
        
    

    Any IE less than IE9 will now use this script to enable the common HTML5 blocks.

    You will still need to use CSS to make the tags display as blocks. I use:

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

提交回复
热议问题