<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style2.css"> <!-- include the path to the style2.css if it's not in the same folder-->
<title>Document</title>
</head>
<body>
<h1>Something...</h1>
</body>
</html>
在你的style2.css中
body{
background-image: url('images/somepicture.jpeg'); /*assuming you have saved the picture in the images folder */
background-size: cover;
}
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: powderblue;
background-image: url('images/somepicture.png');} /* Path to your picture */
h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
2条答案
按热度按时间qni6mghb1#
你是说下面的东西吗
在你的style2.css中
2sbarzqh2#
你的照片也在
index.html
里吗?或者你用Internal-Styles
来做