CSS背景图像URL
我想在CSS bubble中插入一个图像,代码是正确的,但没有显示任何内容, 你能检查一下如何解决这个问题吗CSS背景图像URL,css,Css,我想在CSS bubble中插入一个图像,代码是正确的,但没有显示任何内容, 你能检查一下如何解决这个问题吗 .triangle-isosceles { position: relative; padding: 15px; margin: 1em 0 3em; color: #000; background: #f3961c; -moz-border-radius: 50px; -we
.triangle-isosceles {
position: relative;
padding: 15px;
margin: 1em 0 3em;
color: #000;
background: #f3961c;
-moz-border-radius: 50px;
-webkit-border-radius: 50px;
border-radius: 50px;
/*border-radius: 10px;*/
background: linear-gradient(top, #f9d835, #f3961c);
}
以前
.triangle-isosceles:before {
content: "";
display: block; /* reduce the damage in FF3.0 */
position: absolute;
bottom: -15px;
left: 50px;
width: 0;
border-width: 15px 15px 0;
border-style: solid;
border-color: #f3961c transparent;
}
最后一个在后面
.triangle-isosceles:after{
content: url("/web/resources/images/paul.png");
display: block;
position: absolute;
bottom: -130px;
left: 12px;
width: 110px;
height: 110px;
border:0;
background: #3365d4;
-moz-border-radius: 70px;
-webkit-border-radius: 70px;
border-radius: 70px;
}
在“之后”版本中,您有两个错误:
- 内容:这不是指定背景的正确标签,正确的标签应该是“背景”
- background:正如您在阅读第一个错误时所想,您定义的background属性就是指定背景的属性。必须删除此标记,因为如果未删除,它将被覆盖
.triangle-isosceles:after {
background: url("/web/resources/images/paul.png");
display: block;
position: absolute;
bottom: -130px;
left: 12px;
width: 110px;
height: 110px;
border:0;
-moz-border-radius: 70px;
-webkit-border-radius: 70px;
border-radius: 70px;
}
<>你也应该考虑增加与更多浏览器的兼容性。您可以在此页面上找到更多信息:
编辑:这是向“div”添加背景图像的工作CSS标记的示例:
希望这有帮助:)你也需要添加内容,没有前后内容都不行 像这样:
.triangle-isosceles:after {
content :'';
background: url("/web/resources/images/paul.png");
display: block;
position: absolute;
bottom: -130px;
left: 12px;
width: 110px;
height: 110px;
border:0;
-moz-border-radius: 70px;
-webkit-border-radius: 70px;
border-radius: 70px;
}
图像URL相对于.css文件是否绝对正确?是的,它是正确的,或者我需要更改路径URL?我已经删除了内容,带有背景,现在没有显示任何内容,气泡不再出现。web控制台是否有任何错误?右键单击页面(在浏览器上)->Inspect element->在显示的now选项中,从顶部菜单选择“Console”选项。我知道问题与Symfony有关,因此我们需要在内容中使用AssetURL,结果必须是:content:URL({asset({resources/images/Paul.png')});这是我在我的一个项目中使用的一个示例,说明了您可能想要实现的目标。这个simpli设置了一个div的背景图像。您可以在下面的链接中找到CSS。希望它能帮助我用我在下面的URL中发布的工作示例来支持我的答案。如果代码对您解决问题有用,请随时将mi-answer标记为正确的=)谢谢您的帮助,我认为这是Symfony不了解URL背景的问题不,它不起作用,但我确实使用内容URL和assetic,因为我使用Symfony作为框架,否则谢谢您的帮助:)
.triangle-isosceles:after {
content :'';
background: url("/web/resources/images/paul.png");
display: block;
position: absolute;
bottom: -130px;
left: 12px;
width: 110px;
height: 110px;
border:0;
-moz-border-radius: 70px;
-webkit-border-radius: 70px;
border-radius: 70px;
}