I have one html page named HOME.HTML with this code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
</head>
<style>
*{
margin: 0px;
padding: 0px; }
body { width: 100vw;
height: 100vh;
background: url('telahome2.jpg') no-repeat top center ;
}
</style>
<body>
</body>
</html>
the image file telahome2.jpg is in the root directory but its not loading.
Thanks by any help.
2
Answers
Check your filename for types. Your code is correct.
if your image is in the same folder just write it like this background-image: url(/telahome2.jpg); and don’t write "no-repeat top center" these on the same line. you have to write them line this