Enable support for CSS3 ::outside pseudoelement

后端 未结 3 538
借酒劲吻你
借酒劲吻你 2021-01-04 10:26

I\'d like to be able to use the ::outside pseudoelement, but apparently none of the major browsers support it (based on my testing today).

Is there some

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-04 11:02

    I finally added this snippet to my page:

      $('ol > li').each(function(){
            var $this = $(this);
            var $content = $($this.contents());
            $content.wrapAll('

    '); });

    This adds a p inside the li, which avoids the problem of breaking child selectors, and requiring esoteric names for classes (because there is no parent selector). It also avoids the problems of not inheriting styles, because the ::outside can be replaced with a ::before.

    To achieve the right visual effect, however, requires a negative margin to raise the inner p to the level of the generated content.

提交回复
热议问题