/    Sign up×
Community /Pin to ProfileBookmark

Hi, VERY basic question about background image

Hi,

So I’m just starting to learn HTML, and I’m trying to make a background for the page I’m making with an image on my HD. I have this:

<BODY BACKGROUND=”Yes.jpg”>

Can someone tell me:

1) if the tag/code whatever is right?
2) where I’m supposed to put the tag? ie, Does it matter if I put it before or after the title tag?

3) does the picture I’m using have to be a certain size? It’s 150×150 right now, but I did the 50% offset thing.

Ok, that’s all for now —

Thanks!

to post a comment
HTML

10 Comments(s)

Copy linkTweet thisAlerts:
@TheBearMayApr 16.2006 — That will work. Order of tags should normally be somthing similiar to

<i>
</i>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;script&gt;&lt;/script&gt;
&lt;style&gt;&lt;/style&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;/body&gt;
&lt;/html&gt;

Picture size is workable depending on the layout you're trying for...
Copy linkTweet thisAlerts:
@JaneyIgnoramusauthorApr 16.2006 — Hi,

Thank you so much for your reply. I didn't quite understand some of it, so is it ok if I show you what I have already? And then maybe it will be (painfully) clear?

Here it is:

<HTML>

<TITLE>Cave ab homine unius libre</TITLE><P>

<BODY BACKGROUND="Yes.jpg">

<H1>Beware of anyone who has just one book.</H1>

<B><FONT SIZE="+3">W</FONT></B><FONT SIZE="+1">elcome to my blog. I'm Eva.</FONT>

</HTML>

This is honestly the first thing I've ever done in HTML, so I'm just sort of practicing. Everything is perfect except for the background image, which I can't make appear no matter where I put it.

Argh...sorry to be so silly...

And thanks.
Copy linkTweet thisAlerts:
@drhowarddrfineApr 16.2006 — It's been a long time since I've done it that way but make sure your image is in the same folder as the html file. Also, keep your tags all lower case. HTML doesn't care but XHTML does and so does CSS.

I can see you are using an older text to study this. The <font> and <b> tags are deprecated, iow, going away and not used in html4.01.
Copy linkTweet thisAlerts:
@TheBearMayApr 16.2006 — One other note, your <title></title> elements should be contained within the <head></head> element.

May want to check out the tutorial at: http://www.w3schools.com/html/html_intro.asp
Copy linkTweet thisAlerts:
@JaneyIgnoramusauthorApr 16.2006 — thanks so much for the link -- i got the link for the page i was using before from a friend of mine who's getting his master's in comp sci from mit, so i sort of just assumed that it was up to date...

but the link you gave me makes everything much clearer. so thank you again - i really appreciate the help. ?
Copy linkTweet thisAlerts:
@EOBeavApr 16.2006 — It's just as easy to put your body background image in a separate style sheet.
Copy linkTweet thisAlerts:
@felgallApr 16.2006 — All attributes on the body tag are deprecated as the stylesheet equivalents offer lots more options.

Instead of:

&lt;HTML&gt;

&lt;TITLE&gt;Cave ab homine unius libre&lt;/TITLE&gt;&lt;P&gt;

&lt;BODY BACKGROUND="Yes.jpg"&gt;
&lt;H1&gt;Beware of anyone who has just one book.&lt;/H1&gt;
&lt;B&gt;&lt;FONT SIZE="+3"&gt;W&lt;/FONT&gt;&lt;/B&gt;&lt;FONT SIZE="+1"&gt;elcome to my blog. I'm Eva.&lt;/FONT&gt;

&lt;/HTML&gt;


use

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Cave ab homine unius libre&lt;/title&gt;
&lt;style&gt;
body {background-image:url(Yes.jpg);}
.big {font-size:200%;font-weight:bold}
&lt;/style&gt;
&lt;body&gt;
&lt;h1&gt;Beware of anyone who has just one book.&lt;/h1&gt;
&lt;p&gt;&lt;span class="big"&gt;W&lt;/span&gt;elcome to my blog. I'm Eva.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@blah1985Apr 17.2006 — give the person a break.. this person is just learning HTML. Let them learn 100% html first then add css... I know its not to standard, but come on. when you were learning did you do stuff to standard...
Copy linkTweet thisAlerts:
@EOBeavApr 17.2006 — Actually, somebody took the time to explain how html and css work together when I was just starting out. My only point here is that it is just as easy to learn html and css together as it is to learn how to do layout using html only. And yes, I think it's easier to learn standards from the get-go than it is to unlearn bad coding habits later on.
Copy linkTweet thisAlerts:
@phoenixstonecoApr 17.2006 — if you are just toying around with HTML then i am asuming that you are not uploading your code to an actual web page.

so, lets say your image is saved on your desktop, your tag would look something like this:

<body background="C:/desktop/yes.jpg">

the text between the "" needs to be the direct path to the image. does this make sense to you?
×

Success!

Help @JaneyIgnoramus spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...