This picture将不会显示在页面上。我想知道为什么......
HTML:
<!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:
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;
}
另外,当我调整浏览器窗口大小时,我希望我的图片按比例缩放(宽度和高度)。
答案 0 :(得分:0)
您在体宽语法错误上遗漏了分号
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;
}
&#13;
<section></section>
&#13;
答案 1 :(得分:0)
使用此HTML - 有些东西应该写在节和分号中,身体css也不见了。
<!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 强>
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;
}