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
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.