cannot attatch .css file to html -...

User 1947912 Photo


Registered User
114 posts

wrapper.css is as follows

#wrapper {
width: 1024px;
height: 1000px;
background-image: url('images/home_theme.png');
}

index.html is as follows

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href="css/wrapper.css" rel="stylesheet" type="text/css" media="screen" />

</head>
<body>
<div id="wrapper"></div>
</body>
</html>

I cant see any problems but wrapper.css simply will not attatch to index.html. Im sure there must be something wrong i the code or the way im doing it. Can anyone please help?

www.andysmotorcycles.com
support@andysmotorcycles.com
(01782) 818097
Order motorcycle, scooter and motocross parts, spares and accessories online now.
User 463058 Photo


Ambassador
1,086 posts

background-image: url('images/home_theme.png');

is telling the the browser to look for the image in the "images" folder which is inside the "css" folder. Is this where the image is located? Or are the "images" and "css" folders both at the same level? If that's the case, this bit of css should look like this

background-image: url('../images/home_theme.png');

Image paths in css are relative to the style sheet, not the html.


User 1947912 Photo


Registered User
114 posts

thank you, thats done it.
www.andysmotorcycles.com
support@andysmotorcycles.com
(01782) 818097
Order motorcycle, scooter and motocross parts, spares and accessories online now.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.