Jump to content

Struggling with background image


Dibbets

Recommended Posts

Hi y'all,I'm totally new on this, so obviously this is an easy one for you guys.I'm trying to put a picture on the background. So I typed this in my external style-sheet:p{font-family:Verdana, Geneva, sans-serif;}body {background-image:url('Homer.jpeg');}This is the code in my html-page:<html><head><link rel="stylesheet" type="text/css" href="familie.css"/><title>A Day in The Life</title><body> <p> blablbala </p></body></html>It doesn't work. Is the code wrong? What is it what I do wrong?Appreciate your help.Jer

Link to comment
Share on other sites

Welcome to the forum.Could be any number of things. However, its most likely to do with the paths to the files, or the fact you have no closing <head> tag before the body, like so:</head><body> The way its written there, indicates that all files are in the same folder.Could also be the filename - make sure the image is a jpeg and not jpg, and is Homer and not homer or hOmer or h0mEr or something else like that.Is the <p> tag been styled or is it just the image not showing up?Also, its best to use a doctype: http://www.w3schools.com/tags/tag_DOCTYPE....34b49e99c599801

Link to comment
Share on other sites

Could you repost your full codes, after all the changes? What about the question about the <p> being styled or not?

Link to comment
Share on other sites

Here comes:First the css:p{font-family:Verdana, Geneva, sans-serif;}body {background-image:url("Homer.jpeg");}and the html:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><link rel="stylesheet" type="text/css" href="familie.css" /><title>A Day in The Life</title></head><body><p>blabla<p><p>blablabla.</br>blabla.</br>blabla.</p> <p>blalbla </p></body></html>Furthermore, I don't know what you mean by 'styling the <p>', I'm just a rookie. And I totally agree w/ your tag. Asking the right question is tough, I hope you understand mine. :) Appreciate your help, thanks.

Link to comment
Share on other sites

Within your body, you have three <p> elements. In your CSS, you've specified a font for them... do you see the font you've specified, or is it the same as if you hadn't written anything in the CSS about the <p> elements?(If you don't see anything specified in CSS visualized on screen, then we say the element is not being styled.)The answer to this question is vital, as it would determine if the CSS is even loaded.If it isn't loaded, you won't see anything in there take effect, and then the question becomes if the CSS file is really a CSS file (are you sure it's not familie.css.txt, as Notepad would turn it to by default?), is it called exactly as you've called it from the HTML file? Is it in the same folder?If it is loaded, then the only other problematic place may be the image itself - is it called exactly as specified? Is it in the same folder as the HTML and CSS files?

Link to comment
Share on other sites

Within your body, you have three <p> elements. In your CSS, you've specified a font for them... do you see the font you've specified, or is it the same as if you hadn't written anything in the CSS about the <p> elements?(If you don't see anything specified in CSS visualized on screen, then we say the element is not being styled.)The answer to this question is vital, as it would determine if the CSS is even loaded.If it isn't loaded, you won't see anything in there take effect, and then the question becomes if the CSS file is really a CSS file (are you sure it's not familie.css.txt, as Notepad would turn it to by default?), is it called exactly as you've called it from the HTML file? Is it in the same folder?If it is loaded, then the only other problematic place may be the image itself - is it called exactly as specified? Is it in the same folder as the HTML and CSS files?
Yes, the p is styled then. It's a Verdana sans-serif. Maybe the image is corrupt? You're sure the code is right?
Link to comment
Share on other sites

He meant, are you sure you've got the capitalization of the extension correct?Try loading up the file directly in your browser (i.e. replace the name of the page with "Homer.jpeg") - do you see it then?

Link to comment
Share on other sites

I took a look at the link you provided. The filename, as given by the source, is homer_beer.jpg. Are you changing the image somewhere and renaming it? Also, take a look at Synook's comment. I wasn't overly clear in my previous post. When you upload the image, is the extension .JPEG or .jpeg? Surprisingly, this makes a big difference.

Link to comment
Share on other sites

Stop the presses! We got it! Contrary to what I thought before, the capitalization of the extension were NOT correct. It works! Thank you guys, couldn't do it w/you!Jer
man, that's what people were saying from the second post on :)
Link to comment
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...