为什么我的背景图片不起作用?
HTML
<div class="container-fluid">
</div>
CSS
.container-fluid{
background-image: url('G://etc/vvo/practice/img/bora1.jpg');
}
为什么要开G:?我在工作时间和家里练习我的编码,这就是为什么地点是驱动器g
答案 0 :(得分:1)
.container-fluid{
background-image: url('../img/bora1.jpg');
}
如果图像包含在项目中,则“...”设置图像的路径
答案 1 :(得分:1)
根据您的评论,这可能会解决您的问题。只需使用相对路径,它就会更好更短。
.container-fluid{
background-image: url('img/bora1.jpg');
}
答案 2 :(得分:0)
尝试这样做:
.container-fluid{
background:url(../img/boral.jpg);
}
答案 3 :(得分:-1)
只需在你的项目中创建一个图像文件夹,然后将你的图像放入该文件夹,然后给出该文件夹的路径,如
^\| [a-z0-9\-]+ \|
对你来说这很容易。如果你为该图像创建了一个特殊的类,那么只需将其用于
<img src="images/bora1.jpg">
答案 4 :(得分:-3)
我认为你可以给予
import { Component, OnInit } from '@angular/core';
import { AuthService } from '../../services/auth.service';
import { Router } from '@angular/router';
@Component({
selector: 'app-profile',
templateUrl: './profile.component.html',
styleUrls: ['./profile.component.css']
})
export class ProfileComponent implements OnInit {
let user = {firstName: "", lastName:""};
constructor(private authService: AuthService, private roter: Router) {}
ngOnInit() {
this.authService.getProfile().subscribe(
profile => {
this.user = profile.user;
},
err => {
console.log(err);
return false;
}
);
}
}
如果您的图片与html页面位于同一文件夹中。