Jump to content

Can Someone help me with this CSS/HTML problem?

So I have a div:

<div id="heroroad"> </div>

 

and in my external CSS I have:

#heroroad
{
    background-image:url(M:\School Related Stuff\HTML AND WEB PUBLISHING\CHAPTER 6\javajam6\heroroad.jpg);
    background-size: 100%; 
    height:250px;
}

 

and the picture is not showing when i run it. Can anyone help me?

Link to post
Share on other sites

You have entered a local computer file. This will not get online/through your webserver. Filepath is incorrect.

 

My advice would be: create an images/ directory/folder inside the same folder as where you have the html/css files, and refer to the image like this:

 

background-image:url(images/heroroad.jpg);

 

Also, you used \ instead of / which browsers like alot more.

Link to post
Share on other sites

4 minutes ago, Dutch-stoner said:

You have entered a local computer file. This will not get online/through your webserver. Filepath is incorrect.

 

My advice would be: create an images/ directory/folder inside the same folder as where you have the html/css files, and refer to the image like this:

 

background-image:url(images/heroroad.jpg);

 

Also, you used \ instead of / which browsers like alot more.

Uhh quick update. Did what you suggested, still didnt work. Any other methods? Thanks!

Link to post
Share on other sites

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Random image</title>
<style>
#heroroad
{
    background-image:url(images/heroroad.jpg );
    background-size: 100%;
    height:250px;
}
</style>

</head>

<body>
<div id="heroroad"></div>

</body>

</html>

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×