CSS adjacent sibling selectors, Safari and

前端 未结 1 1617
陌清茗
陌清茗 2021-01-17 15:15

In Safari 5.1.3 I have just noticed that, when writing a CSS adjacent sibling selector (er the + one) and when referencing a

相关标签:
1条回答
  • 2021-01-17 15:52

    This is definitely a Safari bug and you should report it using Safari > Report Bugs to Apple... on a Mac or Help > Report Bugs to Apple... on a PC (or the toolbar button if it's displayed on your Safari toolbar).

    The easiest way out of this is to disable CSS minification if Asset Packager has an option for it.

    If it doesn't have such an option, there exists a quick and dirty workaround: if you only have one nav element directly following your h1, you can use the general sibling selector ~ instead as Safari doesn't appear to have any problems with it:

    h1 ~ nav { ... } /* works fine */
    h1~nav { ... } /* works fine */
    

    jsFiddle preview

    If you have multiple nav elements following your h1, you'll have to override the styles manually for the successive nav elements using h1 ~ nav ~ nav.

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