W3C home > Mailing lists > Public > www-style@w3.org > May 2010

Re: [css3-content] "content" property, replaced elements, and width

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 10 May 2010 09:03:39 -0700
Message-ID: <AANLkTimxDhdm666Mr-dHvs5EAhjEFNzNfeH2vKa_DbJm@mail.gmail.com>
To: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Cc: www-style list <www-style@w3.org>
On Mon, May 10, 2010 at 8:54 AM, Daniel Glazman
<daniel.glazman@disruptive-innovations.com> wrote:
> Le 10/05/10 17:47, Tab Atkins Jr. a écrit :
>
>>>  img.companyLogo {
>>>    content: url(logo.png);
>>>  }
>>>
>>>  img:not(.validatedByComDpt).companyLogo::before {
>>>    background-color: red;
>>>    color: black;
>>>    font-weight: bold;
>>>    content: "VALIDATION REQUIRED";
>>>  }
>>
>> I understand the use-case, but that doesn't say anything about the
>> problem.  ::before is a child of the element it's specified on.
>> Replaced elements officially have no children that CSS can know about.
>>
>> What you want is ::outside::before. ^_^
>
> No problem: add a child element to the <img> in the markup... As dbaron
> said, it's hidden as if it were "display: none", rendering is based on
> the content property and you can then have a ::before.
> The _rendering_ is a replaced element, but the DOM is still here...

<img> is a null element in HTML, and *can't* have children in the markup.  ^_^

~TJ
Received on Monday, 10 May 2010 16:04:43 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:27 GMT