How do I get VML working in standards mode?

前端 未结 2 1485
渐次进展
渐次进展 2021-01-06 01:20

I would like to be able to use vml objects on a page rendering in standards mode rather than quirks mode. I\'ve found fragments of answers scattered around but can\'t figure

2条回答
  •  半阙折子戏
    2021-01-06 02:05

    I think I have it figured out. Step 1 is importing the vml namespace though javascript.

    document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', "#default#VML");
    

    This got some random vml samples to work in quirks mode but not standards. They key is that elements require a unit for measurements where quirks mode will assume px if a unit is not provided. Also shapes have to be styled with position:absolute; although lines apparently do not need this part.

    Here's a sample with 2 ovals. Both ovals will render in quirks mode but the blue oval will not show in standards mode.

    
    
    
    
        
        
        
    
    
    

提交回复
热议问题