首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 ><section>内部的背景图像不会显示

问<section>内部的背景图像不会显示
EN

Stack Overflow用户
提问于 2015-11-15 14:14:01
回答 2查看 681关注 0票数 0

这幅画在我的部分标签(下面的代码)不会显示在页面上。我想知道为什么..。

HTML:

代码语言:javascript
复制
<!doctype html>
<html lang="pl">
<title>Strona</title>
<head>
<meta charset="utf-8">
<link href="style.css" rel="stylesheet" screen="media,projection">
</head>
<body>
<section>
</section>
</body>
</html>

CSS:

代码语言:javascript
复制
html {
 width:100%;
 height:1230px;
}
body {
    width:90%
    height:100%;
}
section {
    width:100%;
    height:19.19%;
    background:url(header.jpg); *this path should work because the file is on my hard drive, this is not the issue of the path..
    background-size:100% 100%;
    background-repeat:no-repeat;
}

另外,当我调整浏览器窗口的大小时,我希望我的图片按比例缩放(宽度和高度)。

EN

回答 2

Stack Overflow用户

发布于 2015-11-15 14:24:33

您丢失的分号在体宽语法错误上

​

代码语言:javascript
复制
html {
    width:100%;
    height:1230px;
}
body {
    width:90%;
    height:100%;
}
section {
    width:100%;
    height:19.19%;
    background-image:url("http://s12.postimg.org/xx34q95m3/header.jpg");
    background-size:100% 100%;
    background-repeat:no-repeat;
}
代码语言:javascript
复制
<section></section>

​

票数 0
EN

Stack Overflow用户

发布于 2015-11-15 14:31:40

使用这个HTML,有些东西应该写在节里,分号在正文中也少了。

代码语言:javascript
复制
<!doctype html>
<html lang="pl">
<head><title>Strona</title>
<meta charset="utf-8">
<link href="style.css" rel="stylesheet" screen="media,projection">
</head>
<body>
<section>Saurabh Singh Mehra</section>
</body>
</html>

CSS

代码语言:javascript
复制
html {
 width:100%;
 height:1230px;
}
body {
    width:90%;
    height:100%;
}
section {
    width:100%;
    height:19.19%;
    background:url(header.jpg);
    background-size:100% 100%;
    background-repeat:no-repeat;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33720657

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档