Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.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 span中作为背景的图像不渲染_Html - Fatal编程技术网

Html span中作为背景的图像不渲染

Html span中作为背景的图像不渲染,html,Html,我有以下课程 .stats { content: url('images/stats.gif'); background-repeat: no-repeat; width: 23px; height: 20px; float: right; } 下面的跨度是多少 <span class="stats" ng-click="showTabDialog(player)"></span> 这在Chrome中渲染得很好,但我在IE1

我有以下课程

.stats {
    content: url('images/stats.gif');
    background-repeat: no-repeat;
    width: 23px;
    height: 20px;
    float: right;
}
下面的跨度是多少

<span class="stats" ng-click="showTabDialog(player)"></span>

这在Chrome中渲染得很好,但我在IE11中看不到图像,即使我可以单击图像应该在的位置,并且它工作正常


为什么我看不到IE中的图像

为什么有
内容:url('images/stats.gif')
content
CSS属性仅适用于伪元素
::before
::after
。我建议尝试将其设置为背景图像:

height: 40px; //change size as needed
width: 40px; //change size as needed
display: block; //Tend to miss this one out
.stats{
背景图像:url('http://onlywm.ru/vbfs_aBlackRed/misc/stats.gif');
背景重复:无重复;
背景尺寸:包含;
宽度:23px;
高度:20px;
浮动:对;
}

为什么有
内容:url('images/stats.gif')
content
CSS属性仅适用于伪元素
::before
::after
。我建议尝试将其设置为背景图像:

height: 40px; //change size as needed
width: 40px; //change size as needed
display: block; //Tend to miss this one out
.stats{
背景图像:url('http://onlywm.ru/vbfs_aBlackRed/misc/stats.gif');
背景重复:无重复;
背景尺寸:包含;
宽度:23px;
高度:20px;
浮动:对;
}
内容CSS属性仅适用于::before和::after伪元素:

Chrome不遵守这方面的规范

您应该使用背景图像。

内容CSS属性仅适用于::before和::after伪元素:

Chrome不遵守这方面的规范


您应该使用背景图像。

显示块添加到css中。背景图像CSS属性仅将图像作为背景。对象的宽度和高度始终由通过CSS/内联样式的静态设置或显示在其中的内容的实际大小定义。在您的情况下,由于您没有在标记之间添加任何内容,因此其x/y维度将为0

.stats {
  width: 23px;
height: 20px;
    background-image: url('http://cdn.arstechnica.net/wp-content/uploads/2016/02/5718897981_10faa45ac3_b-640x624.jpg') ;
    background-repeat: no-repeat;
    display: block;
    float : right;
}

显示块添加到css中。背景图像CSS属性仅将图像作为背景。对象的宽度和高度始终由通过CSS/内联样式的静态设置或显示在其中的内容的实际大小定义。在您的情况下,由于您没有在标记之间添加任何内容,因此其x/y维度将为0

.stats {
  width: 23px;
height: 20px;
    background-image: url('http://cdn.arstechnica.net/wp-content/uploads/2016/02/5718897981_10faa45ac3_b-640x624.jpg') ;
    background-repeat: no-repeat;
    display: block;
    float : right;
}

css中用于渲染图像(背景图像除外)的三个必需属性:

如果没有高度和宽度,则如果资源需要时间渲染,则不会为元素分配区域空间。如果没有显示:块,则图像仅存在于背景中。(在发现这个微妙的错误之前尝试了太多东西)


其他属性是可选的,并且根据您定位图像的要求而需要。

css中用于渲染图像的三个必需属性(背景图像除外):

如果没有高度和宽度,则如果资源需要时间渲染,则不会为元素分配区域空间。如果没有显示:块,则图像仅存在于背景中。(在发现这个微妙的错误之前尝试了太多东西)

其他属性是可选的,并且根据您定位图像的要求而需要