Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

W3C reports error when using the csshover.htc

Posted on 2006-11-28
5
Medium Priority
?
394 Views
Last Modified: 2008-01-09
I am using drop down horizontal navs (all CSS, no javascript) and have uploaded the csshover.htc to my server.
I'm using it in my background as such:
BODY{
      background:#6B8CB8 url(/images/mountains-only.gif) no-repeat 0% 0%;
      font:75% Arial,Helvetica,sans-serif;
      color:#10075A;
      text-align:center;
      behavior:url("/csshover.htc");
      margin:0;
      padding:0;
      background-position: 0% 0%;
}

But I receive a validation error from the W3C validation site that says:
Line: 7 Context : BODY
Property behavior doesn't exist : url("/csshover.htc")

What can I do? I need this drop down to work in IE and I would prefer not to use javascript to get them to work. Is this error fixable?
0
Comment
Question by:alabina
  • 2
  • 2
5 Comments
 
LVL 30

Expert Comment

by:Mark Steggles
ID: 18033194
Greetings alabina,

The behavior property is a proposed addition by microsoft and is still a working draft at w3c http://www.w3.org/TR/becss. I believe it is supported in IE but it wont validate at w3c because it hasnt been approved by w3 yet.

Regards
0
 
LVL 30

Accepted Solution

by:
VirusMinus earned 2000 total points
ID: 18033316
Steggs is right.

to fix this (to some extent) move your IE specific CSS into a seperate file or have it applied using conditional statements like so;

in your main css file, remove the behavior property from the BODY css.

then after your main css call and before you finish your </head> tag in your html

put this;

<!--[if IE]><style type="text/css">body{behavior:url("/csshover.htc");}</style><![endif]-->

this way, atleast your base CSS is valid
0
 
LVL 30

Expert Comment

by:Mark Steggles
ID: 18033332
nice fix VM
0
 
LVL 30

Expert Comment

by:VirusMinus
ID: 18033438
also note, using .htc files is dependant on the client having javascript enabled. its similar to using javascript itself in code. If javascript is turned  off, your hover properties won't work in IE 6 and below
0
 

Author Comment

by:alabina
ID: 18044211
Thank you! That will do it.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question