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

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 UTC