Using z-index

joe_pool_is

Contributor
Joined
Jan 18, 2004
Messages
507
Location
Longview, TX [USA]
I have a couple of spots in my HTML that use z-index.

The HTML displays correctly in Internet Explorer, but will not compile when part of my Visual Studio 2005 website project.

This line, for example:
Code:
[SIZE=1][COLOR=#0000ff]
<[/COLOR][/SIZE][COLOR=#a31515]div[/COLOR] [COLOR=#ff0000]class[/COLOR][COLOR=#0000ff]="logo"[/COLOR] [COLOR=#ff0000]style[/COLOR][COLOR=#0000ff]="z-index:2;"><[/COLOR][COLOR=#a31515]img[/COLOR] [COLOR=#ff0000]alt[/COLOR][COLOR=#0000ff]=""[/COLOR] [COLOR=#ff0000]src[/COLOR][COLOR=#0000ff]="~logos/blue.gif"[/COLOR] [COLOR=#0000ff]/></[/COLOR][COLOR=#a31515]div[/COLOR][SIZE=1][COLOR=#0000ff][SIZE=2]>[/SIZE]
[/COLOR][/SIZE]
Gives me this error:
Error 1 CSS validation: 'z-index' is not a valid CSS property name.
Is there a way to fix this?
 
I have a couple of spots in my HTML that use z-index.

The HTML displays correctly in Internet Explorer, but will not compile when part of my Visual Studio 2005 website project.

This line, for example:
Code:
[SIZE=1][COLOR=#0000ff]
<[/COLOR][/SIZE][COLOR=#a31515]div[/COLOR] [COLOR=#ff0000]class[/COLOR][COLOR=#0000ff]="logo"[/COLOR] [COLOR=#ff0000]style[/COLOR][COLOR=#0000ff]="z-index:2;"><[/COLOR][COLOR=#a31515]img[/COLOR] [COLOR=#ff0000]alt[/COLOR][COLOR=#0000ff]=""[/COLOR] [COLOR=#ff0000]src[/COLOR][COLOR=#0000ff]="~logos/blue.gif"[/COLOR] [COLOR=#0000ff]/></[/COLOR][COLOR=#a31515]div[/COLOR][SIZE=1][COLOR=#0000ff][SIZE=2]>[/SIZE]
[/COLOR][/SIZE]
Gives me this error:Is there a way to fix this?

This looks like it may be an installation issue. I just threw that same code into an ASP.NET project and it compiled without any problems.

VS shouldn't actually validate your CSS like that.

Are you only trying to compile it, or did you also try to debug (F5 or CTRL+F5)?

~Derek
 
Looks like F5 ran it anyway. What do you know?

Visual Studio shouldn't list it as one of the errors with a red 'X' in the Error List bar if it isn't really an error.

Thanks Derek.
 
Looks like F5 ran it anyway. What do you know?

Visual Studio shouldn't list it as one of the errors with a red 'X' in the Error List bar if it isn't really an error.

Thanks Derek.

I'm glad it worked :)

I still find that to be a very strange issue. I've compiled websites dozens of times and have never received an error about CSS.

~Derek
 
That most likely a valid error, and may not render correctly in Firefox, Opera, or Safari. Visual Studio is warning you that it's not "valid CSS" it's not a compiler error, it's an HTML/CSS Markup Error. Your site will compile and run OK; however, your pages may exhibit strange behavior in other browsers.

HTH
 
Back
Top