开发者

css/pre:empty with non-empty pre contents

I have this HTML page

<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>foo</TITLE>
<style type="text/css">
pre:empty {
  display: none;
}
</style>
</HEAD>

<BODY>
<PRE>
some text here in the pre
element
</PRE>
</BODY>
</HTML>

and I wonder why the browser (safari 5.1) does not display anything. I assumed that the pre:empty a开发者_如何转开发pplies only to empty elements. I'd like to hide <pre></pre> tags but none of the pre tags with contents in them.


Just out of interest, try putting it in a style sheet rather that in <style />. The reason for this is:

"In Safari versions up to and including 2, when it appears in an internal style sheet (using tags), this selector will always match. If this selector is used within an external style sheet, it works as designed."

... From (http://reference.sitepoint.com/css/pseudoclass-empty)

Now i know you said you're running 5.1, but its worth a try right?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜