【问题标题】:Customising background from both stylesheet and html从样式表和 html 自定义背景
【发布时间】:2016-03-18 19:57:40
【问题描述】:

我想在 css 样式表中设置我的背景样式,但想在 html 文件中选择背景图像。虽然整个网站的样式将相同,但每个页面上的图像需要不同。

代码示例:

==== CSS ====

身体{
背景位置:中心;
背景重复:不重复;
背景尺寸:1200px 800px;
背景位置-x:中心;
背景位置 Y:50 像素;
}

==== HTML ====
<html> <head> <link href="../css/custom.css" rel="stylesheet"> </head> <body style="background:url('../img/Car.jpg');"> </body> </html>

这似乎不起作用。 CSS 中的样式被忽略。请注意,路径是正确的,因为所有其他元素都有效...

另外,我正在使用 Bootstrap 模板。

请帮忙!

谢谢 D.

【问题讨论】:

  • 只要确保 css 'backgound' 第一行中的错字不会造成麻烦就很好了。

标签: html css background styling


【解决方案1】:

您只使用背景编写了background:url('../img/Car.jpg');:将设置每个背景属性。只需将background:url(); 更改为background-image:url(); :)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-01
    • 2017-12-14
    • 2015-10-04
    • 1970-01-01
    • 1970-01-01
    • 2013-01-11
    • 2021-08-05
    • 2018-09-18
    相关资源
    最近更新 更多