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

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


Received on Monday, 10 May 2010 15:55:14 UTC