473,385 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Writing Valid CSS (help)

Hi, I trying to validate myy CSS using
http://jigsaw.w3.org/css-validator/. I get back some errors, but I
don't understand them. I will leave you with the errors and then the
CSS. Thanks in advance.

Line : 24 (Level : 1) You have no background-color with your color :
div.navigationItem a
Line : 29 (Level : 1) You have no color with your background-color :
div.navigationItem a:link
div.navigationItem a {
display: block;
font-weight: bold;
text-decoration: none;
text-align: right;
letter-spacing: 1px;
margin: 0px;
color: blue; /* THIS IS LINE 24 */
border-top: 1px solid black;
}

div.navigationItem a:link{
background: white; /* THIS IS LINE 29 */
text-decoration: none;
}

Dec 13 '05 #1
9 1388
eomer wrote:
Hi, I trying to validate myy CSS using
http://jigsaw.w3.org/css-validator/. I get back some errors, but I
don't understand them. I will leave you with the errors and then the
CSS. Thanks in advance.

Line : 24 (Level : 1) You have no background-color with your color :
div.navigationItem a
Line : 29 (Level : 1) You have no color with your background-color :
div.navigationItem a:link
These are warning, not errors. The reason is a visitor may have set a
text color the same as your background, and would not be able to see
your text.
div.navigationItem a {
display: block;
font-weight: bold;
text-decoration: none;
text-align: right;
letter-spacing: 1px;
margin: 0px;
color: blue; /* THIS IS LINE 24 */ --> background: white; border-top: 1px solid black;
}

div.navigationItem a:link{
background: white; /* THIS IS LINE 29 */ --> color: black; text-decoration: none;
}


The rule is: if you set one, set the other as well.

--
-bts
-Warning: I brake for lawn deer
Dec 13 '05 #2
eomer wrote:
Hi, I trying to validate myy CSS using
http://jigsaw.w3.org/css-validator/. I get back some errors, but I
don't understand them. I will leave you with the errors and then the
CSS. Thanks in advance.

Line : 24 (Level : 1) You have no background-color with your color :
div.navigationItem a
Line : 29 (Level : 1) You have no color with your background-color :
div.navigationItem a:link

I believe those are only warnings.
To avoid certain problems where foreground or background defaults may
have unintended consequences, it is advisable to pair color and background
together. Most of the time it does not matter.
A common place where this is important is in <body>. A foreground color
(for text) is typically specified but the background color is not. Some
people have a non-white background selected (for whatever reason), say
black, that can contrast poorly with the foreground color, which is
usually black. Hard to read.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Dec 13 '05 #3
In article <1p******************************@40tude.net>,
Beauregard T. Shagnasty <a.*********@example.invalid> wrote:
eomer wrote:
Hi, I trying to validate myy CSS using
http://jigsaw.w3.org/css-validator/. I get back some errors, but I
don't understand them. I will leave you with the errors and then the
CSS. Thanks in advance.

Line : 24 (Level : 1) You have no background-color with your color :
div.navigationItem a
Line : 29 (Level : 1) You have no color with your background-color :
div.navigationItem a:link


These are warning, not errors. The reason is a visitor may have set a
text color the same as your background, and would not be able to see
your text.
div.navigationItem a {
display: block;
font-weight: bold;
text-decoration: none;
text-align: right;
letter-spacing: 1px;
margin: 0px;
color: blue; /* THIS IS LINE 24 */

--> background: white;
border-top: 1px solid black;
}

div.navigationItem a:link{
background: white; /* THIS IS LINE 29 */

--> color: black;
text-decoration: none;
}


The rule is: if you set one, set the other as well.


I don't understand the 2nd warning either: It would seem
he has specified both a color (line 24) and a background
color (line 29), right?

Rob
Dec 13 '05 #4
Rob Stampfli wrote:
In article <1p******************************@40tude.net>,
Beauregard T. Shagnasty <a.*********@example.invalid> wrote:
eomer wrote:
Hi, I trying to validate myy CSS using
http://jigsaw.w3.org/css-validator/. I get back some errors, but I
don't understand them. I will leave you with the errors and then the
CSS. Thanks in advance.

Line : 24 (Level : 1) You have no background-color with your color :
div.navigationItem a
Line : 29 (Level : 1) You have no color with your background-color :
div.navigationItem a:link


These are warning, not errors. The reason is a visitor may have set a
text color the same as your background, and would not be able to see
your text.
div.navigationItem a {
display: block;
font-weight: bold;
text-decoration: none;
text-align: right;
letter-spacing: 1px;
margin: 0px;
color: blue; /* THIS IS LINE 24 */

--> background: white;
border-top: 1px solid black;
}

div.navigationItem a:link{
background: white; /* THIS IS LINE 29 */

--> color: black;
text-decoration: none;
}


The rule is: if you set one, set the other as well.


I don't understand the 2nd warning either: It would seem
he has specified both a color (line 24) and a background
color (line 29), right?


No. In his example, a color is specified for "div.navigationItem a" and
a background color is specified for "div.navigationItem a:link". You
need to assign both for each selector.

--
-bts
-Warning: I brake for lawn deer
Dec 13 '05 #5
In article <2x*****************************@40tude.net>,
Beauregard T. Shagnasty <a.*********@example.invalid> wrote:
Rob Stampfli wrote:

....
div.navigationItem a {
display: block;
font-weight: bold;
text-decoration: none;
text-align: right;
letter-spacing: 1px;
margin: 0px;
color: blue; /* THIS IS LINE 24 */
border-top: 1px solid black;
}

div.navigationItem a:link{
background: white; /* THIS IS LINE 29 */
text-decoration: none;
}

The rule is: if you set one, set the other as well.


I don't understand the 2nd warning either: It would seem
he has specified both a color (line 24) and a background
color (line 29), right?


No. In his example, a color is specified for "div.navigationItem a" and
a background color is specified for "div.navigationItem a:link". You
need to assign both for each selector.


This is a poor example, because the color of a:link *is* typically
set implicitly so its color would generally not be inherited, but
the CSS validator consistently complains, as you say, if you assign
either a color or background-color anywhere without specifying the
other.

But, shouldn't the color and/or background-color be inherited if
one is not explicitly given?

In other words, if you've set the background-color in <body>,
why should you need to restate it explicitly if you later set the
color in, say, a <span>? Why should the validator issue a warning
in such a case?

Rob
Dec 13 '05 #6
Rob Stampfli <re*****@hotmail.com> wrote:
But, shouldn't the color and/or background-color be inherited if
one is not explicitly given?
Yes. But from what is it going to be inherited?
In other words, if you've set the background-color in <body>,
why should you need to restate it explicitly if you later set the
color in, say, a <span>? Why should the validator issue a warning
in such a case?


The C in CSS is for "Cascading". Rules from other style sheets can cascade
with your rules. As an example, you might specify color and background for
BODY elements, but a user style sheet might specify color and background
for P elements. If you specify only color for SPAN elements, which
background will they be shown against?
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"I'd love to make time, if only I could find the recipe."
Dec 13 '05 #7
In article <dn**********@blue.rahul.net>,
Darin McGrew <mc****@stanfordalumni.org> wrote:


Rob Stampfli <re*****@hotmail.com> wrote:
But, shouldn't the color and/or background-color be inherited if
one is not explicitly given?


Yes. But from what is it going to be inherited?
In other words, if you've set the background-color in <body>,
why should you need to restate it explicitly if you later set the
color in, say, a <span>? Why should the validator issue a warning
in such a case?


The C in CSS is for "Cascading". Rules from other style sheets can cascade
with your rules. As an example, you might specify color and background for
BODY elements, but a user style sheet might specify color and background
for P elements. If you specify only color for SPAN elements, which
background will they be shown against?


Granted. But, a user style sheet could just as easily specify a
background image for P elements, yet I don't see the validator
complaining about the lack of an explicit "background-image:"
attribute to undo this on every element where a "color" is
specified. So why pick on "background-color"?

Rob
Dec 13 '05 #8
Rob Stampfli wrote:
So why pick on "background-color"?


Because it is so frequently abused by newbie authors? :-)

--
-bts
-Warning: I brake for lawn deer
Dec 13 '05 #9
re*****@hotmail.com (Rob Stampfli) writes:
Granted. But, a user style sheet could just as easily specify a
background image for P elements, yet I don't see the validator
complaining about the lack of an explicit "background-image:"
attribute to undo this on every element where a "color" is
specified. So why pick on "background-color"?


Usually better to use "background" rather than "background-color" in
author stylesheets, for precisely that reason. I thought the CSS
checker *did* advise that, but maybe not.

--
Chris
Dec 14 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: MB | last post by:
I am writing an FTP Client using the NIO packages because I want to use the non-blocking functionality. I have done this successfully except for the fact that after I "put" an image file to the...
4
by: Nhwk | last post by:
I have an unsigned char banner, which contains data for a 12x8 bitmap file. I am attempting to construct and write to disk a .bmp file with this data. So far, I started by constructing the...
4
by: daniel.w.gelder | last post by:
I wrote a template class that takes a function prototype and lets you store and call a C-level function, like this: inline string SampleFunction(int, bool) {..} functor<string (int, bool)>...
17
by: Eric Lindsay | last post by:
Is learning to write CSS a better use of time than finding and using a package that produces complete web pages? I've moved to a new platform (Macintosh), taking with me about 400 personal web...
6
by: hpy_awad | last post by:
I am writing stings ((*cust).name),((*cust).address)to a file using fgets but rabish is being wrote to that file ? Look to my source please and help me finding the reason why this rabish is being...
7
by: John Pote | last post by:
Hello, help/advice appreciated. Background: I am writing some web scripts in python to receive small amounts of data from remote sensors and store the data in a file. 50 to 100 bytes every 5 or...
4
by: John Pote | last post by:
Hello, help/advice appreciated. Background: I am writing some web scripts in python to receive small amounts of data from remote sensors and store the data in a file. 50 to 100 bytes every 5 or...
0
by: bohuge | last post by:
Hey! At the time being I'm working on a backup solution for a Qtek9090 pocketpc, which should be able to find and backup outlook data to a server, local files, messages and contact from the sim...
0
by: lavicool | last post by:
Hi all, I just joined the post. Iam new to C programming. I have a question regarding a problem for my assignment. The problem is i have a input file with student ID, 5 program scores, midterm and...
2
by: db2learner | last post by:
Hi, I am new to DB2 and i just started worked on it a couple of days back. I have created basic EMPLOYEE table from control centre which has 2 fields: EmpNo, EmpName. I am trying to write...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.