Home > Software design >  HTML Using local image as background
HTML Using local image as background

Time:03-19

I have troubles using a local image as my background in HTML. Anyone who maybe can give me an tip on what at l should try to change in order to make the code work.

<!DOCTYPE html>
<html>
    <head>
        <title>Test</title>
        <meta http-equiv="Content-Type" content="=text/html; charset=UTF-8">
        <style>
            html,body { width: 100%; height: 100%; }
        </style>
    </head>
    <body style="background: url('file:///C:/Users/skole/Onedrive/NTNU/Annet/Test/bakgrunn.jpeg');">
    </body>
<body>

    <h1>Test</h1>
</body>

<html>

CodePudding user response:

The path to image should lead from Your .html file. So, the question is where is Your .html file situated, for example, if it is in folder TEST, path should be: url('./bakgrunn.jpeg') or just url('bakgrunn.jpeg');

  • Related