[HTML][CSS][HELP] Placing an element
I tried to place this element with HTML and CSS:
http://img250.imageshack.us/img250/520/navbarsp0.png
I needed it inside another DIV, but didn't really work.
Here's the HTML and CSS
HTML
Code:
<!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="da" lang="da">
<head>
<title>-------</title>
<meta name="pragma" content="no-cache" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="content-style-type" content="text/css" />
<link href="include/main_screen.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="content">
<img src="images/logo.png" /><br /><br /><br />
<div id="nav_bar">
</div>
</div>
</body>
</html>
CSS
Code:
html,body {
margin: 0;
padding: 0;
}
body {
font-family: Corbel, Verdana;
background: #FFFFFF;
margin: 1em;
}
#content {
width: 90%;
max-width: 45em;
border-width: 2px;
border-style: solid;
border-color: #7B6573;
background: #848EC6;
margin: 1em auto;
padding: 1em;
}
#nav_bar {
background-image: url("images/nav_bar.png");
background-repeat: no-repeat;
background-attachment: fixed;
position:absolute;
top: 100px;
left: 200px;
}
Need help with this...
Re: [HTML][CSS][HELP] Placing an element
In what way didn't it work?
You can try to set the image as background in the div: style="background-image:url('somewhere/image.png');"
Re: [HTML][CSS][HELP] Placing an element
The image doesnt show up at all
About that style in div, yeah I know but I would like to keep it in my external css file.
Re: [HTML][CSS][HELP] Placing an element
is your image path "include/images/nav_bar.png" ?
if not, maybe
background-image: url("../images/nav_bar.png");
because the image path needs to be relative to the css file
Re: [HTML][CSS][HELP] Placing an element
Nope, its not in the include folder its in images.
Here's how my ftp looks like:
[FOLDER]images/
[FOLDER]include/
[FILE]index.html
But yeah, I'll try changing the path
EDIT: Tried changing the path, still doesn't work.
Re: [HTML][CSS][HELP] Placing an element
ok I've tested it and now it works with some changes:
PHP Code:
#nav_bar {
background-image: url(../images/nav_bar.png);
background-repeat: no-repeat;
position:absolute;
top: 100px;
left: 200px;
height: 30px;
width: 100px;
}
I had to omit the "background-attachment: fixed" and set the width and height of the div
Re: [HTML][CSS][HELP] Placing an element
Ok good, everything works fine now, thanks alot ZoopaJr ;)