Re: Reseting CSS on div

On Thursday, October 23, 2014, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> On Thu, Oct 23, 2014 at 3:51 AM, Bruce Lawson <brucel@opera.com
> <javascript:;>> wrote:
> > On 23 October 2014 11:36, Behrang Saeedzadeh <behrangsa@gmail.com
> <javascript:;>> wrote:
> >> Hi,
> >>
> >> Have there been any discussions to allow defining a div that ignores any
> >> styling defined outside it and only honors <style> tags defined within
> it?
> >
> > Isn't that what div { all:initial }  is for?
> > http://dev.w3.org/csswg/css-cascade/#all-shorthand
>
> No, that blocks *inheritance* and anything setting styles directly on
> the <div> itself, but it does nothing for the contents of the <div>.
>
> (Also, it's terrible, because it means the <div> is, for example, set
> to display:inline.  We really need the "default" keyword that only
> ignores author styles.)


 Not to keep harping on it, but remind me again why we don't have the
`default` keyword?


> Behrang, what you want is Shadow DOM, which does precisely this -
> unless you use special combinators to pierce into the shadow DOM, no
> styles from outside can reach in (and no styles from inside ever reach
> out, no matter what you do).
>
> ~TJ
>
>

-- 
Mike Sherov

Received on Friday, 24 October 2014 02:52:30 UTC