User-Agent: Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 MultiZilla/188.8.131.52a If I specify a block with a style of "text-decoration: underline" then images are rendered with underline within this block. The only way to prevent the underline from being drawn is by having the image as the only element within that block. This is only a problem in standards compliance mode. IE works fine with this. From the spec (http://www.w3.org/TR/CSS2/text.html#propdef-text-decoration): "If the element has no content or no text content (e.g., the IMG element in HTML), user agents must ignore this property." Interesting that the above statement is sort-of applied, if I try to set a style directly on the image, it has no effect. overline and line-through are also a problem, although an image without transparency would just draw directly over the line. I didn't test blink. Reproducible: Always Steps to Reproduce: 1. Create a block: <span style="text-decoration: underline">Text<img src="xxx"/>Text</span> 2. Add a proper DOCTYPE (for instance, xhtml1.0) declaration and observe that the image is now underlined. 3. Add style directly to the image: style="text-decoration: none" 4. Add the image to its own separate block that doesn't include any text: <span style="text-decoration: underline">Text</span><span style="text-decoration: underline"><img src="xxx"/></span><span style="text-decoration: underline">Text</span> Actual Results: 1. The browser (in quirks mode) displays no underline under the image. 2. The browser (in standards compliant mode) displays an underline under the image. 3. The browser continues to display an underline for the image. 4. Even in standards compliance mode, the image doesn't display an underline. Note: In quirks mode a broken image is shown with the alt="" text displayed underlined, which is perfect IMO. Expected Results: Images should never display underlines or any other text decoration.
The standards mode behavior is what the CSS2.1 spec specifies. Note the language about text-decoration being painted by the element, not its children, in the spec.
verified. it's not the image that has the underline, it's the element containing the img.