Can someone help please? I am using css to post a background image on a webpage but its not working......?

2009-06-23 5:52 am
The code I'm using on the css external style sheet is:
Body {background: url(../images/namehere.gif) top center repeat-x;
}

Can someone advise me what I'm doing wrong?

回答 (4)

2009-06-23 11:00 am
✔ 最佳答案
Don't capitalize the tag "body". Generally use the shortcut method:

body {
background: #XXXXXX url(path to image) repeat-x left center scroll;
}

"#XXXXXX" is the hex color code for the bg color if you want one. Doing it the long way is outmoded although IE may still like it.

Make a Webpage:

Full Web Building Tutorials: http://www.w3schools.com/
Beginner's HTML Tutorial: http://www.htmlbasix.com/
How to Create a Webpage: http://www.make-a-web-site.com/
So You Want To Set Up Your First Site, Huh?: http://www.htmlgoodies.com/tutorials/getting_started/article.php/3479561
Web Site Blog: http://www.instant-web-site-tools.com/blog/
http://www.w3schools.com/site/default.asp
How to Start / Create Your Own Website: The Beginner's A-Z Guide: http://www.thesitewizard.com/gettingstarted/startwebsite.shtml
So, you want to make a Web Page!: http://www.pagetutor.com/html_tutor/index.html
Getting started with HTML: http://www.w3.org/MarkUp/Guide/

Ron
2009-06-23 8:31 am
are you linking it to the correct URL?

Make sure this part [../images/namehere.gif] is correct. Let me know if you need more help.
2009-06-23 7:14 am
It's much easier to declare all the properties separately.

body{
background-image: url('whatever');
background-attachment: fixed;
background-position: X% Y%;
background-repeat: repeat-x;
}

Note that body is not capitalized and the url property uses single quotes.
2009-06-23 7:41 am
The proper form is
body
{
background-image: url('filename');
...
}
參考: web2coders.com


收錄日期: 2021-05-01 16:39:27
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20090622215233AAfOoTe

檢視 Wayback Machine 備份