TEL:400-8793-956
当前位置:程序、服务器

如何使用背景图像编写响应式标题

提问者: 近期获赞: 浏览人数: 发布时间:2021-08-03 08:44:57

 问:你好!我正在尝试编写一个响应式标题背景,可以在顶部显示一个表单,供人们注册网络研讨会。我已经保存了图像并正确引用了它,但它没有显示出来。

 
我的策略是使用我的 PSD 中具有适当高度和宽度的 div 元素,然后使用里面的表单元素对其进行编码。
 
到目前为止,这根本不起作用。div 根本不会与背景一起显示。
 
这是我的 html:
 
<!DOCTYPE html> 
< html  lang = "en" > 
< head > < meta charset = "utf-8" > < meta name = "generator" content = "CoffeeCup HTML Editor (www.coffeecup.com)" > < meta name = "dcterms.created" content = "Sat, 21 Nov 2015 22:11:09 GMT" > <元名称= "description" content = "" ><元名称=  
 
     "keywords"  content = "" > 
< link rel = "stylesheet" type = "text/css" href = "style.css" > < title >事件登陆器</ title > </ head > < body > < div class = "header-rectangle" > < h1 class = "whiteheadline" >加入我们的免费网络研讨会!</ h1 >       
 
  div  id = "header-bg"  align = "center" > 
< h1 >欢迎!</ h1 > </ div > </ body > </ html >  
 
这是我的 CSS:
 
* {
  边距:0px;
}
 .whiteheadline {
    字体大小:48px;
    字体系列:“打开 Sans”;
    颜色:RGB(255、255、255);
    字体粗细:粗体;
}
 .header-rectangle { 
    背景颜色:rgb(104, 115, 251);
    文本对齐:居中;
    行高:143px;
}
 #header-bg {
 background-image: url:(http://ppc-genius.com/wp-content/uploads/2015/11/EventLander.png);
背景重复:不重复;
高度:541px;
背景重复:不重复;
背景色:#ffffff;
背景附件:固定;
背景位置:顶部中心;
背景尺寸:封面;
 
位置:相对;
}
我才刚刚开始编码。只显示标题文本,但没有标题图像显示为背景,即使它在上面的 CSS 中清楚地编码。
 
 
答:如果你在你的 background-image 属性中删除括号之前和 url 之后的冒号,应该对它进行排序。
 
#header-bg {
 background-image: url(http://ppc-genius.com/wp-content/uploads/2015/11/EventLander.png);
背景重复:不重复;
高度:541px;
背景重复:不重复;
背景色:#ffffff;
背景附件:固定;
背景位置:顶部中心;
背景尺寸:封面;
位置:相对;
}
希望有帮助!
上一篇: 属性和实例的解释?
下一篇: 线条颜色不是从红色开始的