help me people! i need to have an image as my background, because otherwise it misaligns my html page, but i also need to have a white background for the design. the image is my banner, so i have it on no-repeat and it just appears once at the top. heres the code: #content { background-image: url(ocr_banner.png); background-repeat: no-repeat; background-color:white; width: 600px; border: 1px solid silver; } first person to help me wins!
What's the question exactly? You want a white background with one background image... you've got that. So what do you need? And how does it "misalign your html"? Pictures pweaz. Also, go ahead and shorten your code. Background properties can be grouped into one line if you want: #content { background: #fff url(ocr_banner.png) center 0 no-repeat; width: 600px; border: 1px solid silver; } Just like you already did with the border.
uhm, well it just has a white background, and doesnt show the image. so it seems like the background color code is overriding the image code.
Ah. Why don't you give the white background to the body then, and leave the #fff out of the #container? If still nothing shows up, there's something else going on.
Ah. Well, when I typed in http://learnhtml.we.bs/ocr_banner.png I got Page Not Found. So, your image will never show up. If you get it back on the server, it should sit at the top left corner of the white box (#content). If the image is on the server, then your path is wrong. You have in your css url(ocr_banner.png) which means it needs to be sitting in the same folder as the html and css is. As a side note, although you CAN write an html page with just <html>, it's never good practise because the <!DOCTYPE...> will tell the browser which type of html page it is. Otherwise, they have to guess. So, you should encourage your readers to add Doctype and you don't have to know everything about them, just that there are three types (loose, strict and transitional) and that your tags should do certain things and look a certain way with certain ones. It seems you already know the diff between html and xhtml.
How about you upload the image or give us the correct location of the content background image? It's not in the root and it isn't in the images directory (referring to ocr_banner.png)
yeah i know its not gonna be perfect now, but im just working on the design mostly. uhm for some reason the ocr banner wont open. it is in the same folder, but it seems to be messed up somehow. a page with this comes up: 403 Forbidden You must supply a local referer to get URL '/OCR_Banner.png' from this server. thttpd/2.21 20apr2001 lol nice avatar soulscratch. oh oh uh, the url is http://learnhtml.we.bs/OCR_Banner.png
Yeah okay. I don't know anything about referrers but this banner must be someone else's advertisement and not just an image sitting on your own server. Someone may be blocking referrers or you may be blocking referrers. If you have a sysadmin talk to him/her. Otherwise, I'd go to whereever you can actually see the image and copy it to your own server, so it displays. If you're doing this all on your own then google stuff like Apache referer and surely you can find how to add one to your image.