Forum Moderators: not2easy

Message Too Old, No Replies

CSS Validation Error

error in validating CSS.

         

domainboy

1:42 pm on Apr 17, 2008 (gmt 0)

10+ Year Member



Hi,

I have created a site page which is a valid XHTML now.
But when i try to validate the CSS is says the following error

Value Error : height only 0 can be a length. You must put an unit after your number : 18

This is the CSS I have written

#header-div
{
position:absolute;
width: 934px;
left: 34px;
height:18;

}

I have 8 errors in the CSS and it seems that this is the only error i get..

Then I tried putting px after the number 18. Like this
#header-div
{
position:absolute;
width: 934px;
left: 34px;
height:18px;

}

Still the problem exists

I dont understand what the problem is.

Can someone please help me

Thank you for your time

wrgvt

3:28 pm on Apr 17, 2008 (gmt 0)

10+ Year Member



Just a guess, but don't you need a "top" parameter for absolute positioning? Perhaps it can't compute height because it doesn't have a starting reference.

domainboy

4:23 pm on Apr 17, 2008 (gmt 0)

10+ Year Member



Hi.

I am sorry. I am new to css. I dont understand what you say :(
Thank you

swa66

11:35 pm on Apr 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Where did you validate that fragment ?

[jigsaw.w3.org...]

validates

#header-div
{
position:absolute;
width: 934px;
left: 34px;
height:18px;

}

as a valid fragment.

...

Xapti

11:45 pm on Apr 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



show us all your CSS (don't link it)... it may be something more complicated that just that snippet.

What wrgvt was saying though, is that when you absolute position something, you should generally specify at least a top (and/or bottom) and a left (and/or right). Sitenote: IE6 does not support cumulative use of top with bottom nor left with right (which is why absolute positioning designs are not really used, among other reasons), but that is not relevant to your problem.

I doubt it's the case, because someone said that code snippet validates, but he was suggestion you give a "top" offset, just like you gave a "left", because you typically should use both.

[edited by: Xapti at 11:48 pm (utc) on April 17, 2008]

g1smd

1:44 am on Apr 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The original message was telling you that all numbers must have units specified with them: # (for colours), px, em, etc.

Only zero can omit the units, as zero of something is the same as zero of anything else.