Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 通过内容在同一DIV中显示图像和文本_Html_Css_Internet Explorer 8_Css Content - Fatal编程技术网

Html 通过内容在同一DIV中显示图像和文本

Html 通过内容在同一DIV中显示图像和文本,html,css,internet-explorer-8,css-content,Html,Css,Internet Explorer 8,Css Content,我正在为IE浏览器创建一个打印CSS,在其中我必须通过CSS在div中添加文本和图像。 我使用content添加文本,使用background添加图像,但不知何故图像没有显示出来 我就是这样做的 #header .container:after { content: "@The_Text_after_Twitter_Logo"; background: url("../path_to/logo-twitter.png"); position:a

我正在为IE浏览器创建一个打印CSS,在其中我必须通过CSS在div中添加文本和图像。 我使用
content
添加文本,使用
background
添加图像,但不知何故图像没有显示出来

我就是这样做的

#header .container:after { 
        content:  "@The_Text_after_Twitter_Logo";
        background: url("../path_to/logo-twitter.png");
        position:absolute; 
        width:999em; 
        height:25px; 
        margin:0 0 0 5px; 
}
这样做对吗?我在什么地方做错了吗


谢谢。

:after
在IE中是一个空的伪类,这意味着它没有预定义的盒子模型,您需要给它一些显示

display: block;

这应该能奏效

不幸的是,这对杰米没有帮助。你能举个例子吗?也许是JS提琴?我创建了一个JFIDLE,它在那里工作:/但在IE8的打印评论中不起作用(您正在使用打印样式表吗?
@media print{…}
是的。它用于打印。