/    Sign up×
Community /Pin to ProfileBookmark

struggling with gradient backgrounds in CSS…. (image)

ok so i know this might be a tired topic for a lot of you guys, but i have searched everywhere on the internet and the code seems to be the same… yet when i try to use it i can’t get it to work properly?

anyway, here’s the code i’m using:

[quote]

<style type=”background/css”>
<!–
body {
background-color: #8D93B3;
background-image: url(files/backgroundgradient.jpg);
background-position: top;
background-repeat: repeat-x;
}
–>
</style>

[/quote]

before i did this i defined a new CSS tag as “background”. i had also created an image in photoshop that was 1 px by 500 px
with a gradient done inside of it – the bottom part of the gradient is the color code you see in my coding.

however when i preview in browser it shows no background (just white).
ideally i’d like to do the gradient angular (top to bottom, left to right) like printhuge’s website:
[url]http://printhuge.com/[/url]

if you can recommend how i can do that, i would be very grateful. i initially thought to just create the entire page on photoshop as a giant image (i can create that gradient on photoshop). BUT then i’d have a huge image file to load on the page and that won’t account for any size window, obviously.

admittedly i am new to this and have been doing the dreamweaver tutorials & whatnot, i’m not a professional, but am doing what i can to learn. thanks SO much for any help! ?

EDIT: i’ve read this page on this site:
[url]http://www.google.com/url?sa=U&start=5&q=http://www.webdeveloper.com/forum/showthread.php&#37;3Ft%3D117264&ei=MHO9SeiBE4HwsAOUk8E5&sig2=S3UaRjoUpmhoCLStpu8Ufw&usg=AFQjCNGRB2IDiJk1lTB9Rn4k7ufjA8P_LQ[/url]
(that’s how i found this site). i’ve tried that code too, and it doesn’t work either for me. what am i doing wrong?

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@6StringGeekMar 15.2009 — Try this:
[CODE]<style type="text/css">[/CODE]

I think you can shorten your version to this:

[CODE]<style type="text/css">
body {
background: #8D93B3 url(files/backgroundgradient.jpg) repeat-x;
}
</style>[/CODE]


and you don't need the <!-- and --> marks. peace.
Copy linkTweet thisAlerts:
@ryanlundMar 16.2009 — Hmmm, could be a few problems

a) not sure if this makes a difference but on the above comment the url has no apostrophe's around it(think thats what theyre called). I never miss them off so im not sure if it changes anything but you could try:

<i>
</i>background: #8D93B3 url('files/backgroundgradient.jpg') repeat-x;


b) is your file path right. for example if your css was in css/style.css then to get to your image file then you would have to go up a level, eg ../files/backgroundgradient.jpg - hope that made sence.

c) &lt;style type="background/css"&gt;
never seen that before so im fairly sure it isnt right. change this to &lt;style type="text/css"&gt; and give it a bash

hope ive been of some use

Ryan
×

Success!

Help @ABTsportsline 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.16,
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,
)...