无法在Safari上应用display:flex到iframe的body元素?

时间:2022-02-20 08:20:59

I have been trying to apply a rule to body element of an iframe like so:

我一直试图将规则应用于iframe的body元素,如下所示:

body {
  background:white; 
  margin:0; 
  overflow:hidden; 
  height:100vh; 
  width:100vw; 
  font-size: 3vw; 
  display:flex !important; 
  align-items:center; 
  justify-content:center; } 

But what it instead applies on Safari is this:

但它在Safari上应用的是:

  body{
    display:block;
    margin-top: 8px;
    margin-right: 8px;
    margin-bottom: 8px;
    margin-left: 8px; ...}

It overrides the rules I set for both margin and display with its own defaults *UserAgent stylesheet. Is there a way to stop it from doing this?

它会覆盖我为边距和显示设置的规则以及它自己的默认值* UserAgent样式表。有没有办法阻止它这样做?

[Update] As of iOS7+ updates this bug is no longer valid.

[更新]从iOS7 +更新开始,此错误不再有效。

1 个解决方案

#1


0  

Try to set class to body like that

尝试将类设置为body

    .anyClass{
       display:flex;
       ...
    }

If this will not work try to send jsFidle code

如果这不起作用,请尝试发送jsFidle代码

#1


0  

Try to set class to body like that

尝试将类设置为body

    .anyClass{
       display:flex;
       ...
    }

If this will not work try to send jsFidle code

如果这不起作用,请尝试发送jsFidle代码