The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Background color only in Opera...
ALSumner
post Oct 15 2006, 09:39 AM
Post #1


Newbie
*

Group: Members
Posts: 14
Joined: 15-October 06
Member No.: 446



Hi there,

I am taking a web design class, and my HTML is working fine, except for one thing: my background color is only showing up in Opera. I've tried it in IE6, Firefox, and Safari in addition to Opera...

Can someone help me? I have a feeling it has to do with my DOCTYPE declaration, since I really don't understand how to use this yet; I had to copy it from my text book...

Thanks SO much!
Amanda smile.gif

p.s. Here's my code:

<!-- here is my DOCTYPE declaration --><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Resume</title>
<style type="text/css">
<!-- here is my background color -->
body {
background-color: #123456
}
</style>
</head>
<body> <!-- here is my anchor --><a name ="address">
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 15 2006, 10:01 AM
Post #2


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



Both the Doctype and the code example look OK, but you shouldn't use SGML comments like

CODE
<!-- here is my background color -->


in a style sheet. Use the following syntax instead:

CODE
/*here is my background color */


Side-notes:

* The link in your example is not closed (neither is the <body> or <html> elements, but in their case it's optional).

* I recommend not putting anything before/above the Doctype (not even a comment), since doing so puts IE6 into "quirksmode" where it emulates the bugs of IE5.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
stjepan
post Oct 15 2006, 10:46 AM
Post #3


Serious Coder
*****

Group: Members
Posts: 329
Joined: 15-October 06
From: zagreb, croatia
Member No.: 445



QUOTE

background-color: #123456


There should be semicolon at the end.

This post has been edited by stjepan: Oct 15 2006, 10:47 AM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Oct 15 2006, 11:00 AM
Post #4


This is My Life
*******

Group: Members
Posts: 1,128
Joined: 24-August 06
From: t-dot
Member No.: 16



QUOTE

There should be semicolon at the end.
By definition you don't need it unless there's another property following, but i have found in practice it's a good idea to have it.

This post has been edited by jimlongo: Oct 15 2006, 11:06 AM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 15 2006, 11:05 AM
Post #5


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



QUOTE(stjepan @ Oct 15 2006, 05:46 PM) *
QUOTE

background-color: #123456


There should be semicolon at the end.


You don't have to use a semi-colon if it's the last style declaration (like in this case), even though it's a good habit.

See also http://htmlhelp.com/reference/css/quick-tutorial.html
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ALSumner
post Oct 15 2006, 02:27 PM
Post #6


Newbie
*

Group: Members
Posts: 14
Joined: 15-October 06
Member No.: 446



Thank you for replying so very quickly; however, I made the changes recommended, and they didn't work (even though they were not necessary, I want to get in the habit of writing <i>good</i> HTML...

There is more syntax to my page, but I only included what I was having trouble with. Perhaps that was a mistake.

Here is the whole page.

Thanks again!
Amanda

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><!-- there is my DOCTYPE declaration -->
<html>
<head>
<title>Resume</title>
<style type="text/css">
<!-- here is my background color -->
body {
background-color: #123456;
}
</style>
</head>
<body> <!-- here is my anchor --><a name ="address">

<center><br />Amanda Person<br />
123 Anywhere Street<br />
Indianapolis, Indiana, 46000<br />
317-555-1212<br />
<!-- here is a clickable link to yahoo.com --> <a href= "http://www.yahoo.com/">e-mail@domainname.com
</a>
</center>
<hr />

<di>
<dt><i>Objective</i></dt>
<br />
<dd>To pursue a career in which I can use my professional abilities and computer skills.</dd>
<br />
<br />
<i>Work History</i><br />
<!-- here is the start of my list --><ul>

<li>2002-present: Veterinary Hospital, Indianapolis, Indiana.</li> <i>Skills:</i> phlebotomy, catheter placement, anesthesia monitoring, computer and equipment upgrades and maintenance, customer service, patient recovery.</li><br />
<br />
<li>1997-2002: Large University, Indianapolis, Indiana.<br /> <i>Skills:</i> used office equipment, including fax, credit card terminal, computer, customer service, answered multi-line telephone system, dealt with cash.</li><br />
</ul>
<br />
<i>Education:</i><br/>
<!-- here is list #2 --><ul>
<li> Anywhere High School, Indianapolis, Indiana; graduated with honors in 1997</li><br />
<li> Large University, Indianapolis, Indiana; will graduate in 2010</li>
</ul><br/>
<center><a href ="#address">Back to address information</a></center><br />
</body>
</html>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 15 2006, 02:44 PM
Post #7


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



You use XHTML syntax in a HTML document (the extra slashes in for instance <br />. That's not the cause of your problem though. Some of the other errors shown by the validator may be. Also, you still have the HTML comment in your style sheet.
http://www.htmlhelp.com/tools/validator/

All that said, I see the background color just fine. Are you sure this is all you have? tongue.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Oct 15 2006, 08:14 PM
Post #8


This is My Life
*******

Group: Members
Posts: 1,128
Joined: 24-August 06
From: t-dot
Member No.: 16



It is the html comment in your style sheet that is causing the problem.
at least in the older version of Safari (1.3.2) I just checked it in.

Remove
CODE
<!-- here is my background color -->


This post has been edited by jimlongo: Oct 15 2006, 08:16 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 15 2006, 08:31 PM
Post #9


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



But IE doesn't mind one bit so there must be something more.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Oct 15 2006, 09:51 PM
Post #10


This is My Life
*******

Group: Members
Posts: 1,128
Joined: 24-August 06
From: t-dot
Member No.: 16



QUOTE(pandy @ Oct 15 2006, 09:31 PM) *

But IE doesn't mind one bit so there must be something more.


I find it funny you would defend the correctness of IE's rendering. laugh.gif

Safari, Firefox, Omniweb, Camino browsers display no background color with that comment in, all display the background color intended with the comment out.
Oh, that even goes for Explorer 5.2Mac.

Interesting that BBedit (my editor) doesn't even recognize the comment as such in source syntax coloring. IOW it isn't grey as html comments usually are.

Change the comment to
CODE
/* here is my background color */
and it's all okay, both in browsers and editors.

You'll have to check in IE to see if that fixes it.

This post has been edited by jimlongo: Oct 15 2006, 09:54 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 15 2006, 09:55 PM
Post #11


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



QUOTE
I find it funny you would defend the correctness of IE's rendering. laugh.gif


I don't. The OP said the color doesn't show in IE. With the code he posted it does show. So there must be something other than what we have seen that makes IE not show the background color. blink.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Oct 15 2006, 10:03 PM
Post #12


This is My Life
*******

Group: Members
Posts: 1,128
Joined: 24-August 06
From: t-dot
Member No.: 16



Well i see what you're saying, but the proof seems to be in the pudding (as they say). Put it the comment in, it doesn't render the color . . . take it out it does.
As to why the color didn't render for the OP, I guess she'll have to answer that . . . maybe the list of browsers wasn't right?
My suspicion would be that it only renders in IE6, and not the others.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 15 2006, 10:15 PM
Post #13


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



Nope, previous versions don't mind either. Of course the comment shouldn't be there. All of us have pointed that out.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Oct 15 2006, 10:20 PM
Post #14


This is My Life
*******

Group: Members
Posts: 1,128
Joined: 24-August 06
From: t-dot
Member No.: 16



should have said only Windows explorer, and not the others.
5,6,7 I'm sure they're all equally standards compliant.

This post has been edited by jimlongo: Oct 15 2006, 10:20 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
stjepan
post Oct 16 2006, 09:46 AM
Post #15


Serious Coder
*****

Group: Members
Posts: 329
Joined: 15-October 06
From: zagreb, croatia
Member No.: 445



I just removed comments before 'body', left anything as it was, and background works.

CODE

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<!-- there is my DOCTYPE declaration --> ***************
<html>
<head>
<title>Resume</title>
<style type="text/css">

<!-- here is my background color -->  ****************

body {
background-color: #123456;
}
</style>
</head>
<body> <!-- here is my anchor --><a name ="address">
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 29th March 2024 - 05:28 AM