我想给离子工具栏提供背景图像,因为图像太大,所以我想使用image-size: cover
作为背景图像,以便它最适合离子工具栏。
我试图给出以下格式,但它不起作用,任何想法如何让它工作。
ion-toolbar {
--background: url(assets/images/background/bg-header-flag.jpg) no-repeat cover;
--min-height: 200px;
}
经过努力,终于得到了答案
--background: url('assets/images/background/bg-header-flag.jpg') center/ cover no-repeat;
下面是使用背景属性的简写表示法的语法。
background: bg-color bg-image position/bg-size bg-repeat bg-origin bg-clip bg-attachment initial|inherit;
有关更多详细信息,请查看https://www.w3schools.com/cssref/css3_pr_background.asp
您还可以参考以下链接获取背景大小属性: