Help - Search - Members - Calendar
Full Version: background image
HTMLHelp Forums > Web Authoring > Cascading Style Sheets
minidiapolis
On www.fountainchurch.org why isn't the background image covering the whole page?

Ignore the text for now
pandy
Because you tell it not to.

QUOTE
body {
background-image: url(pictures/fountain.gif);
background-repeat: no-repeat;
background-position: center;
background-color: #8CDEF5; /*color is dark blue*/
color: CCCCCC; /*color is light grey*/
}


'no-repeat' means the background shouldn't tile. Or did you mean something else?
minidiapolis
I'm sorry I mean I want the picture covering the whole page, not tilted. . . does that make sense?

Also why isn't the text formatting registering?
pandy
Do you want it to stretch? That's not possible with a background image. That's in CSS 3, but alas that won't be supported in many years.

If you mean it isn't vertically centered in the browser window in some browsers, that's because BODY isn't heigher than its content. There are ways around that.
minidiapolis
I'm not understanding I did it on http://www.cs.iupui.edu/~mjsmith/footprints
pandy
Afraid you didn't. That image is HUGE to start with. Less than half of it diplays on my screen. I never see the couple.
http://www.cs.iupui.edu/~mjsmith/pictures/footprints.jpg

You can make an image stretch, just not a background image. If it's important to you, you can stretch an inline image (use 'width: 100%. and no height) and position it behind the content.
minidiapolis
can you refresh my memory on how to stretch an inline image
minidiapolis
can you refresh my memory on how to stretch an inline image
minidiapolis
I think I got it
minidiapolis
The image problem is fixed temporarily. . . maybe. . . sad.gif

But the text formatting isn't registering, why?
Darin McGrew
If you fix the doctype, then the markup validator's report will be more useful. Plus, you'll avoid triggering quirks mode in browsers.

The W3C's CSS validator reports CSS errors that you need to fix.
pandy
What text formatting? You mean the margins and stuff? Because of the errors maybe.
http://jigsaw.w3.org/css-validator/validat...;usermedium=all

Also, if you intend the margin-top to work between paragraphs, it won't as long as you use fake paragraphs created with <br><br>.

You should fix the HTML too, especially the doctype.
http://www.htmlhelp.com/cgi-bin/validate.c...s&input=yes

Don't type those things. Copy them. happy.gif
http://www.htmlhelp.com/tools/validator/doctype.html
minidiapolis
thanks for the help. . . . . . I really do appreciate it.

technically speaking, I could put the test on top of the picture using the float element, right?
pandy
No. You need to use positioning or negative margins.
minidiapolis
oh ok. . .

I was taught you put margin-left:, not margin-left :
minidiapolis

I'm not understanding what's wrong with
<!DOCTYPE html PUBLIC "~//W3C//DTD HTML 4.01 Transitional//EN" "http://w3.orgTR/hrml4/loose.dtd">
pandy
QUOTE(minidiapolis @ Jan 31 2008, 03:31 AM) *

I was taught you put margin-left:, not margin-left :


Yes, but margins can have negative values and with a little luck a negative margin will move the element. A negative top margin moves it upwards and so on. Positioning would probably be better for what you want to do though.

QUOTE
I'm not understanding what's wrong with
<!DOCTYPE html PUBLIC "~//W3C//DTD HTML 4.01 Transitional//EN" "http://w3.orgTR/hrml4/loose.dtd">


You mistyped or copied from a bad place. The validator points to the error. You have a tilde (~) where it should be a hyphen.
"-//W3C//DTD HTML 4.01 Transitional//EN"
not
"~//W3C//DTD HTML 4.01 Transitional//EN"

As said, don't try to type them. Copy from a good source.
minidiapolis
thank you so much for pointing that out
minidiapolis
Can someone explain these errors. . . I'm not understanding

</head>✉
Most likely, you nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>

Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, in HTML the <head> element must contain a <title> child element, lists (ul, ol, dl) require list items (li, or dt, dd), and so on.


Line 20, Column 11: "." is not a member of a group specified for any attribute.
"Hey. . . Wait. . . Where's that water coming from? It's not raining."

Line 26, Column 30: an attribute specification must start with a name or name token.
<div style = margin-left : "20%"> ✉
An attribute name (and some attribute values) must start with one of a restricted set of characters. This error usually indicates that you have failed to add a closing quotation mark on a previous attribute value (so the attribute value looks like the start of a new attribute) or have used an attribute that is not defined (usually a typo in a common attribute name).

Line 33, Column 116: cannot generate system identifier for general entity "lat".
…VjA2ZwLWJ1dHRvbgRzbGsDbGluaw--#mvt=m&lat=40.830195&lon=-85.109384&mag=6&q1=57✉
An entity reference was found in the document, but there is no reference by that name defined. Often this is caused by misspelling the reference name, unencoded ampersands, or by leaving off the trailing semicolon (wink.gif. The most common cause of this error is unencoded ampersands in URLs as described by the WDG in "Ampersands in URLs".

Entity references start with an ampersand (&) and end with a semicolon (wink.gif. If you want to use a literal ampersand in your document you must encode it as "&amp;" (even inside URLs!). Be careful to end entity references with a semicolon or your entity reference may get interpreted in connection with the following text. Also keep in mind that named entity references are case-sensitive; &Aelig; and &aelig; are different characters.

If this error appears in some markup generated by PHP's session handling code, this article has explanations and solutions to your problem.

Note that in most documents, errors related to entity references will trigger up to 5 separate messages from the Validator. Usually these will all disappear when the original problem is
Darin McGrew
QUOTE(minidiapolis @ Jan 31 2008, 08:40 AM) *
Can someone explain these errors. . . I'm not understanding
Where did you get those error messages?

QUOTE(minidiapolis @ Jan 31 2008, 08:40 AM) *
</head>✉
Most likely, you nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>

Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, in HTML the <head> element must contain a <title> child element, lists (ul, ol, dl) require list items (li, or dt, dd), and so on.
Our online validator says
CODE
Error: missing a required sub-element of HEAD
Sure enough, you don't have a title element, which is required in the head element.

QUOTE(minidiapolis @ Jan 31 2008, 08:40 AM) *
Line 20, Column 11: "." is not a member of a group specified for any attribute.
"Hey. . . Wait. . . Where's that water coming from? It's not raining."
A couple lines earlier, you have mismatched quotes:
CODE
width = "100%'


QUOTE(minidiapolis @ Jan 31 2008, 08:40 AM) *
Line 26, Column 30: an attribute specification must start with a name or name token.
<div style = margin-left : "20%"> ✉
An attribute name (and some attribute values) must start with one of a restricted set of characters. This error usually indicates that you have failed to add a closing quotation mark on a previous attribute value (so the attribute value looks like the start of a new attribute) or have used an attribute that is not defined (usually a typo in a common attribute name).
You need to quote the entire style attribute, like this:
CODE
<div style = "margin-left : 20%">


QUOTE(minidiapolis @ Jan 31 2008, 08:40 AM) *
Line 33, Column 116: cannot generate system identifier for general entity "lat".
…VjA2ZwLWJ1dHRvbgRzbGsDbGluaw--#mvt=m&lat=40.830195&lon=-85.109384&mag=6&q1=57✉
An entity reference was found in the document, but there is no reference by that name defined. Often this is caused by misspelling the reference name, unencoded ampersands, or by leaving off the trailing semicolon (wink.gif. The most common cause of this error is unencoded ampersands in URLs as described by the WDG in "Ampersands in URLs".

Entity references start with an ampersand (&) and end with a semicolon (wink.gif. If you want to use a literal ampersand in your document you must encode it as "&amp;" (even inside URLs!). Be careful to end entity references with a semicolon or your entity reference may get interpreted in connection with the following text. Also keep in mind that named entity references are case-sensitive; &Aelig; and &aelig; are different characters.

If this error appears in some markup generated by PHP's session handling code, this article has explanations and solutions to your problem.

Note that in most documents, errors related to entity references will trigger up to 5 separate messages from the Validator. Usually these will all disappear when the original problem is
Sure enough, Ampersands (&'s) in URLs explains the problem.
minidiapolis
I'm starting to get it. . . the margins still aren't registering. You don't put quotes around them in the css file, right?
Darin McGrew
You still have syntax errors in your CSS.

Yes, you should remove the extra quotes.
minidiapolis
I feel like a total idoit but I cannot figure out what's wrong in the css file. I have tried
margin-left : 20%;
"margin-left : 20%";
margin-left : "20%";
Darin McGrew
Here is your current style sheet:
CODE
body {
    background-color: #8CDEF5; /*color is dark blue*/
    color: CCCCCC; /*color is light grey*/
    }
p{
    margin-left : 25%;
    margin-right : "20%";
}

Here it is with the syntax errors corrected:
CODE
body {
    background-color: #8CDEF5; /*color is dark blue*/
    color: #CCCCCC; /*color is light grey*/
    }
p{
    margin-left : 25%;
    margin-right : 20%;
}
Darin McGrew
However, the style for p elements won't be applied until you fix the mismatched quotes in your HTML:
CODE
width = "100%'

You've got only one <p> tag, and it gets eaten by the mismatched quotes.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.