You are here: Re: Background prob! « HTML « IT news, forums, messages
Re: Background prob!

Posted by Chris Beall on 11/23/38 11:41

Leonidas Athineos wrote:
> 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация