I want to call a css from my index.html, and the css is in a CSS folder, also there is an image in a images folder..
I have tried different ways but no luck
The directory looks like this
My_First_Website
Javascript Resources
WebContent
css
mystyles.css
images
mybackgroundImage.png
index.html
Now mystyles.css looks like this
@CHARSET "ISO-8859-1";
body
{
background-image:url('/WebContent/images/mybackgroundimage.png');
}
And my HTML page looks this
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="/WebContent/css/mystyles.css" media="screen" />
<title>My Website</title>
</head>
<body>
</body>
</html>
Right now the page shows empty :(. Please help 🙂
Change
/WebContent/css/mystyles.cssin your HTML file to/css/mystyles.css, and change/WebContent/images/mybackgroundimage.pngin your CSS file to../images/mybackgroundimage.png./WebContentunderWebContentmeansMy_First_Website/WebContent/WebContent, notMy_First_Website/WebContent.