/    Sign up×
Community /Pin to ProfileBookmark

using a custom background?

hi, im completely new to .css – but in tutorials, its not clear at all how to use your own background, something as simple as that.

right now im using: (not .css)
<BODY background=”location”>

but seems only i see the background and no one else does lol.

Another question is that, a web page i just made = [url]www.freewebs.com/wayne_styla/links.html[/url] (just a mock website i made for my friends) and if it is not maximized…. and you resize the window – then the text breaks into different lines instead of getting a scrollbar at the bottom. Why is this?

to post a comment
CSS

32 Comments(s)

Copy linkTweet thisAlerts:
@Paul_JrFeb 13.2004 — You can check out [URL=http://www.w3schools.com/css/css_background.asp]this link[/URL] for some info on CSS backgrounds.

Now, from looking at the site, the reason other people aren't seeing the background is because you aren't linking to it properly. You'll need to have the image located on your web server; not your computer.

And the reason the text breaks up, is because it's just text, so naturally it will move around as you resize the window, so it's all viewable. Once you get into more complicated CSS layouts, you'll be confronted with the choice of designing a layout that [i]won't[/i] break up at all like that, or a layout that will be fluid and will resize to fit the browser window and different resolutions.

http://www.w3schools.com/css/default.asp is a good place to start out learning CSS. ?
Copy linkTweet thisAlerts:
@NewbieLearnerauthorFeb 14.2004 — ahh, thanks m8.... ive been linked to that webbie before, so i suppose its bound to be good.... ?
Copy linkTweet thisAlerts:
@Paul_JrFeb 14.2004 — [i]Originally posted by NewbieLearner [/i]

[B]ahh, thanks m8.... ive been linked to that webbie before, so i suppose its bound to be good.... ? [/B][/QUOTE]

You're welcome. ?

Yup, that W3Schools place is pretty good. They've got tutorials on just about any language out there. :p
Copy linkTweet thisAlerts:
@Ben_RogersFeb 15.2004 — yes w3schools is good stuff.

the syntax for a background would be

selector {background: url(location) color bottom/top left/right no/x/y-repeat?;}
Copy linkTweet thisAlerts:
@NewbieLearnerauthorFeb 15.2004 — okies, thanks ?
Copy linkTweet thisAlerts:
@etLuxFeb 15.2004 — This link might also be useful:

[URL=http://msdn.microsoft.com/library/default.asp?url=/workshop/author/css/reference/attributes.asp]CSS Reference[/URL]

Down the page, check background, etc.

As CSS has matured, there's a great deal you can do with background images -- but for some reason, few developers have taken advantage of the capabilities.

A few idea scripts:

[URL=http://www.codelifter.com/main/javascript/2waybackslide.html]Background Images SlideShow[/URL]

[URL=http://www.codefoot.com/javascript/script_background_scroller.html]Background Image Scroller - Vertical[/URL]

[URL=http://www.codefoot.com/javascript/script_background_scroller_h.shtml]Background Image Scroller - Horizontal[/URL]
Copy linkTweet thisAlerts:
@Ben_RogersFeb 15.2004 — that isnt css. thats js.
Copy linkTweet thisAlerts:
@pyroFeb 15.2004 — [i]Originally posted by omega [/i]

[B]the syntax for a background would be



selector {background: url(location) color bottom/top left/right no/x/y-repeat?;} [/B]
[/QUOTE]
Wrong order, though...

http://www.w3.org/TR/REC-CSS2/colors.html#propdef-background
Copy linkTweet thisAlerts:
@etLuxFeb 15.2004 — [i]Originally posted by omega [/i]

[B]that isnt css. thats js. [/B][/QUOTE]


If you can do that (scripts mentioned above) [I]without CSS style properties[/I] I'd be interested in the technique.
Copy linkTweet thisAlerts:
@Ben_RogersFeb 15.2004 — you can. css just makes it easier. and any pages that use cheapFX like that i dont look at, ill just X out.
Copy linkTweet thisAlerts:
@Ben_RogersFeb 15.2004 — [i]Originally posted by pyro [/i]

[B]Wrong order, though...



http://www.w3.org/TR/REC-CSS2/colors.html#propdef-background [/B]
[/QUOTE]


oh well. i just took that off the top of my head.
Copy linkTweet thisAlerts:
@etLuxFeb 15.2004 — [i]Originally posted by omega [/i]

[B]you can. css just makes it easier...[/B][/QUOTE]

Would you perhaps be kind enought to show me how?
Copy linkTweet thisAlerts:
@Ben_RogersFeb 15.2004 — Well I didn't review that script but I assume they use document.style.background, so they could just use document.body.background. it wouldn't be correct, per se, but it should work.
Copy linkTweet thisAlerts:
@Paul_JrFeb 15.2004 — [i]Originally posted by pyro [/i]

[B]Wrong order, though...



http://www.w3.org/TR/REC-CSS2/colors.html#propdef-background [/B]
[/QUOTE]

Eh, really? I always did it like
<i>
</i>&lt;style type="text/css"&gt;
/*&lt;![CDATA[*/
html, body {
background: url(images/background.jpg) #000 no-repeat fixed top center;
}
/*]]&gt;*/
&lt;/style&gt;

[FONT=courier new]

Image -> Color -> Repeat -> Attachment -> Position[/FONT]

That always worked...
Copy linkTweet thisAlerts:
@Ben_RogersFeb 15.2004 — it may work but i think hes saying its not correct. like using bgcolor- it works, bbut its not right.
Copy linkTweet thisAlerts:
@etLuxFeb 15.2004 — [i]Originally posted by omega [/i]

[B]Well I didn't review that script but I assume they use document.style.background, so they could just use document.body.background. it wouldn't be correct, per se, but it should work. [/B][/QUOTE]


How?
Copy linkTweet thisAlerts:
@NewbieLearnerauthorFeb 15.2004 — Eh, thanks for the help guys, ive bookmarked the sites, nice debate ?
Copy linkTweet thisAlerts:
@Paul_JrFeb 15.2004 — [i]Originally posted by NewbieLearner [/i]

[B]Eh, thanks for the help guys, ive bookmarked the sites, nice debate ? [/B][/QUOTE]

These "debates" tend to happen often and may get out of hand. ? ?
Copy linkTweet thisAlerts:
@Ben_RogersFeb 15.2004 — [i]Originally posted by Paul Jr [/i]

[B]These "debates" tend to happen often and may get out of hand. ? ? [/B][/QUOTE]


often? try always.
Copy linkTweet thisAlerts:
@pyroFeb 15.2004 — The debates are fine, such as this thread, it's the getting off topic in every thread that needs to stop...
Copy linkTweet thisAlerts:
@Ben_RogersFeb 15.2004 — hm.. i have no idea what you're talking about *innocent*

yeah, it seems every thread I'm in is off topic... :o
Copy linkTweet thisAlerts:
@NewbieLearnerauthorFeb 16.2004 — yeah, it seems every thread I'm in is off topic... [/QUOTE]

lol, does this say anything? ?
Copy linkTweet thisAlerts:
@Ben_RogersFeb 16.2004 — yes, but im always like that. pyros going to kill me one of these days.
Copy linkTweet thisAlerts:
@etLuxFeb 17.2004 — [i]Originally posted by omega [/i]

[B]it may work but i think hes saying its not correct. like using bgcolor- it works, bbut its not right. [/B][/QUOTE]


I've been programming since 1966, so I do have just

a little experience... and a general maxim upon which

I and a great many colleagues agree goes more like

this, Omega:

If it works it [I]must[/I] be right... lol.
Copy linkTweet thisAlerts:
@pyroFeb 17.2004 — You're kidding me, right? Just because something works does [i]not[/i] mean it's right...
Copy linkTweet thisAlerts:
@etLuxFeb 17.2004 — [i]Originally posted by pyro [/i]

[B]You're kidding me, right? Just because something works does [i]not[/i] mean it's right... [/B][/QUOTE]

Could you be kind enough to defend that viewpoint, please?
Copy linkTweet thisAlerts:
@pyroFeb 17.2004 — Certainly.

Basically every language has it's own specifications. Take (X)HTML for instance. What does a <h1> tag mean/do? Does it simply mean large, bold text? Nope, not at all. <h1> tags should only be used to markup top-level headings. How about this:

&lt;a href="javascript:window.open("http://www.w3.org");"&gt;open&lt;/a&gt;

Is that right? Nope, though it will work in browsers that hava JavaScript enabled. So the right way?

&lt;a href="http://www.w3.org" onclick="window.open(this.href); return false;"&gt;open&lt;/a&gt;

Why? A couple of reasons, really. First, javascript: is not a valid protocol for a URL, and while the first code will work in all browsers that I know of (providing they have JavaScirpt enabled). However, it uses an incorrect protocol for the URL, which means nothing is technically required to support it. The latter, of course, also has the added benefit of working when JavaScript is disabled, but that is a different issue.

How about you? Where are you coming from when you say if it works it's right?
Copy linkTweet thisAlerts:
@Ben_RogersFeb 17.2004 — Yep ?

It's like you could breathe underwater, it would work, the surrounding atmosphere would be inhaled... but then you'd drown. So it'd work, but... yeah.

Oh and no commenting on the suckiness of my analogies.
Copy linkTweet thisAlerts:
@etLuxFeb 17.2004 — [i]Originally posted by pyro [/i]
&lt;a href="javascript:window.open("http://www.w3.org");"&gt;open&lt;/a&gt;
Is that right? Nope ... [/QUOTE]


That's example of what [I]does not work[/I] (in browsers with JavaScript disabled).

I do not see how that contradicts my statement: If it works it [I]must[/I] be right.
Copy linkTweet thisAlerts:
@Ben_RogersFeb 17.2004 — Well, I guess that is true, if you aren't standards compliant.
Copy linkTweet thisAlerts:
@DaveSWFeb 17.2004 — [i]Originally posted by etLux [/i]

[B]That's example of what [I]does not work[/I] (in browsers with JavaScript disabled).

[/B]
[/QUOTE]


But if you had javascript enabled [i]you wouldn't know it didn't work[/i].

So how about a compromise:

If it works in all browsers at all times, and complies with the w3c, then it must be right.

?
Copy linkTweet thisAlerts:
@Ben_RogersFeb 17.2004 — so basically if its up to web standards....
×

Success!

Help @NewbieLearner 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 5.14,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...