Re: Reseting CSS on div

Thanks Tab. Yes Shadow DOM does what I was looking for. Looking forward for it to be adapted by all major browser.

Sent from my iPad

> On 24 Oct 2014, at 8:33 am, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> 
>> On Thu, Oct 23, 2014 at 3:51 AM, Bruce Lawson <brucel@opera.com> wrote:
>>> On 23 October 2014 11:36, Behrang Saeedzadeh <behrangsa@gmail.com> 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.)
> 
> 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

Received on Saturday, 25 October 2014 04:54:32 UTC