Padding doesn't work when using <section> tag in IE

I use HTML5 <section> in my application, the addition for <section> works fine in chrome, ff and safari, but it doesn't work in IE ..

I tried adding display: block; with section style but its not useful ...

any solution?

+6
source share
3 answers

Many older browsers do not understand HTML5 tags, such as section , and use the reserve of processing them as inline elements in a document stream.

IE goes beyond that and completely ignores HTML5 tags. To fix this, you need to add tags to the document through Javascript. Fortunately, there is very good HTML5Shiv that you can embed in your html header, for example:

  <!DOCTYPE html> <head> <!--[if lt IE 9]> <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> 

Any IE smaller than IE9 will now use this script to include common HTML5 blocks.

You still need to use CSS to render tags as blocks. I use:

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

My answer would be that the <section> not supported in older versions of IE, so something like augmentation is not possible without jjjashash javascript suggestion or, better, using a tag that is supported as <div> or even <p> depending on what you want to do.

+1
source

As others noted, the <section> element is one of the new HTML5 elements that is not supported in versions of IE below 9.

I'm not sure how accurate this article is , but they can pull the effect after using XHTML5. However, there are many caveats that must be taken very carefully into account in order to make it work (for example, not submitting an XML declaration in IE, as this will force IE to switch to quirks, but you need to give it to another browser, etc. .)

However, the advantages of this approach are that you do not need Javascript to make it work, and therefore can serve users with Javascript disabled.

0
source

Source: https://habr.com/ru/post/896850/


All Articles