Background prob!

  • Thread starter Leonidas Athineos
  • Start date
L

Leonidas Athineos

Hi i am new in html,and building my home page.
i want to put a pic as background.
with the following.

<style type="text/css">
body
{
background-image:
url('flagprisonllble1.jpg');
background-repeat:
no-repeat;
background-attachment:
fixed
}
</style>

and tried with this too..


<body background="flagprisonllble1.jpg">


but doesnt work!
could anyone help me please... :)
thanks!!

bye
 
P

Paul Watt

Leonidas Athineos said:
Hi i am new in html,and building my home page.
i want to put a pic as background.
with the following.

<style type="text/css">
body
{
background-image:
url('flagprisonllble1.jpg');
background-repeat:
no-repeat;
background-attachment:
fixed
}
</style>

and tried with this too..


<body background="flagprisonllble1.jpg">


but doesnt work!
could anyone help me please... :)
thanks!!

bye

Are the images in the same folder as your css/html pages? a url might help

Paul
 
L

Leonidas Athineos

hi!
Yes they are.i tried to change the pixel size,bec i thought it might
help...burt finally it didnt.
The thing is that there are actually some pictures that i can display as
backgrounds but others not

thanks for the help
 
G

geniolatenio

<style type="text/css">
body
{
background-image:
url('flagprisonllble1.jpg');
background-repeat:
no-repeat;
background-attachment:
fixed
}
</style>

and tried with this too..


<body background="flagprisonllble1.jpg">

Mmmmm, seems correct to me. Is that the correct position where your
image is on your hard disk? Is it in the same folder as the html file
you're coding?

Bye

geniolatenio
 
A

Arne

Once upon a time *Leonidas Athineos* wrote:

(Please, don't top post on usenet. Now corrected)
hi!
Yes they are.i tried to change the pixel size,bec i thought it might
help...burt finally it didnt.
The thing is that there are actually some pictures that i can display as
backgrounds but others not

thanks for the help

And you are sure that the image "flagprisonllble1.jpg" really is a *.jpg
image and with that exact name? The question may sound stupid, if you
know it is. But asking anyway, because sometimes people upload images
saved as *.bmp, *.psp or something without knowing it. Also file names
are case sensitive ("flagprisonllble1.jpg" is not the same as
"Flagprisonllble1.JPG") and that also happends often.
 
L

Leonidas Athineos

yes,the pic name is correct..and its jpg
and i have saved it at the same folder as the index file.
:(

bye
 
G

geniolatenio

yes,the pic name is correct..and its jpg
and i have saved it at the same folder as the index file.
:(

Well, try this: create a new page containing this stuff:

<html>
<body background="flagprisonllble1.jpg">
test
</body>
</html>

If it works then create your style with only the background-image
thing and replace the aforementioned body tag with a <body>. Check if
it works. If it does, add all your other stuff in the CSS, one by one,
and everytime you add something go and check if the bg is still there.
Keep doing that until you see that it doesn't work. Than that's the
problem.

p.s. you can use

body { background: url(image) fixed no-repeat }

instead of what you're using.

Bye

geniolatenio
 
A

Arne

Once said:
yes,the pic name is correct..and its jpg
and i have saved it at the same folder as the index file.
:(

Well it's hard to continue the guessing game :)
Would you provide the URL to the page or at least to the image, that
would helpful if you like more help. Help us to help you! :)
 
A

Arne

Once said:
yes sure, its this
http://home.tu-clausthal.de/~itla/index.html
please dont be hard on judging, i am still new here.i started learning html
and css from the web 3 days ago!


thanks for the help though!!

It would be even better if you stop the top posting, as I allready
mentioned earlier. That is, post your reply below the content you are
replying to, after snipping off the signature part belowe the "-- " line
that you also should use as a signature delemiter.

Ok, about the page you posted the URL to. First there is a different
background image than the one you mentioned in your original post,
starting this thread.

Now you have "background-image: url('kornpaper800.jpg');" and not the
initial "url('flagprisonllble1.jpg');" and the "kornpaper800.jpg" image
shows just fine. Was this something you did recently and did you give up
on the 'flagprisonllble1.jpg'? However the image is not covering the
whole browser window, since it is set to "no-repeat".

Second, your markup is a mess, giving 24 errors in the HTML-validator
for that minimum of code and content. See the errors here:
http://validator.w3.org/check?verbose=1&uri=http://home.tu-clausthal.de/~itla/index.html

Among the errors is missing doctype, markup and content abowe and within
the <head> and </head> that not belong there. Yes, I know you are new in
html and that the page is "still under constraction!", but you should
try to do it right from the beginning to avoid to many problems on the
way. :)

The image "Prince Leo.jpg" (should be "princeleo.jpg") is not loaded to
the page, maybe it's not uploaded to the server, or the name is different?
 
C

Chris Beall

Leonidas said:
yes sure, its this
http://home.tu-clausthal.de/~itla/index.html
please dont be hard on judging, i am still new here.i started learning html
and css from the web 3 days ago!
(snip)

Leo,

OK, the page with the current background loads OK, so you know the
syntax for loading a background image is correct. But that's not the
image you wanted.

I tried to access the image directly, i.e. I entered
"http://home.tu-clausthal.de/~itla/flagprisonlable1.jpg"
on the address line of my browser, but I got a 404 error, so the server
cannot find that file. Did you place that background image on the
server? In the same directory as the index.html page? If you think the
answers are both 'yes', then something went wrong, 'cause it isn't
there. Solve that and then change the reference URL and it should work.

Now, about the HTML. Some key points:

1. You need a DOCTYPE. Without it, the browser has no idea what variant
of HTML you are using. See
http://pages.prodigy.net/chris_beall/TC/DOCTYPE.html for details. [If
you read the other stuff at that site you will be WAY ahead of most
people...]

2. HTML documents have a certain structure. The basic structure is:
html
head
body

i.e. the head comes before the body. Certain things should only appear
in the head (title, meta information, style element), others should
appear only in the body (paragraphs, headers, lists, tables, images,
etc..) You have things all jumbled up.

3. The bible for HTML is the HTML 4.01 specification, which you can find
at http://www.w3.org/TR/html401/cover.html#minitoc, but I usually prefer
to go straight to the table of elements, which is at
http://www.w3.org/TR/html401/index/elements.html or attributes at
http://www.w3.org/TR/html401/index/attributes.html. Not always easy
reading... When you see something marked 'Deprecated', that means it is
becoming obsolete. Don't use it. Instead, use the appropriate CSS
styling; sometimes the HTML spec will actually give you hints about what
that might be.

4. The bible for CSS is at
http://www.w3.org/TR/CSS21/cover.html#minitoc, but again I prefer to
start at the list of properties at http://www.w3.org/TR/CSS21/propidx.html.

5. There are three physical ways to use CSS. You can combine all three.
a. Inline style: example: <p style="text-align: center">yadda
yadda</p>. This styles a specific HTML element. See
http://www.w3.org/TR/html401/present/styles.html#adef-style.
b. <style> element: This is what you are doing now. It styles
things according to a SELECTOR, which could be an element name (like
img, which styles all <img> elements), a class (which can style multiple
elements on a page, regardless of what element they are, or an ID (which
styles a single element) or combinations of these. <style> elements
must be in the <head> section of the page. There can be more than one
of them, but there is no need to do so. See
http://www.w3.org/TR/html401/present/styles.html#edef-STYLE.
c. A separate style sheet. This extends the flexibility of the
previous approach to provide one style sheet for multiple pages, with
each page simply pointing to the style it should use. See the <link>
element in the tutorial at http://www.w3.org/TR/CSS21/intro.html#q1.

When you are starting out, it's best to use 'a' or 'b', but you should
quickly graduate to 'c' because it allows you to have one style sheet
for an entire site, thus avoiding duplication and helping to create a
consistent style across the site.

Chris Beall
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top