Jump to content

Opacity and a missing semicolon, don't understand


thesoundsmith

Recommended Posts

I am getting errors from the CSS validator this is in the header:

  h3#slideshow {position:absolute; z-index:-100; top: 160px; border:0; width:220px;height:220px;padding:0;border:0; opacity:0.53;filter:alpha(opacity:53;}  

and this is in the body:

	    <div id="anvsoftJavaScriptSlideshow" style="width: 260px; height: 260px; position: absolute; left: 546px; top: 126px; opacity:0.53;filter:alpha(opacity:53);"> 

It works fine, but generates errors

20  h3#slideshow  attempt to find a semi-colon before the property name. add it-1  h3#slideshow  Parse Error null305   attempt to find a semi-colon before the property name. add it304   Parse Error null

20 and -1 are from the head, 305 from the body. I assumed the problem was that opacity wasn't valid for h3 or div, so I separated the img out but got the same errors - doesn't like the opacity call. But as it works fine, I reverted. The page is at http://www.thesoundsmith.com/index.html How do I fix this? I took the command right from the w3c school site just to be sure I had the punctuation right - no change... Thanks in advance.

Link to comment
Share on other sites

Thanks, DD. I fixed the paren, and discovered a couple other odd items that I corrected (there were two instantiations of the same slideshow) relocated the body setup data into the head, and it boils down to:With opacity added, I get: 17 #anvsoftJavaScriptSlideshow attempt to find a semi-colon before the property name. add it -1 #anvsoftJavaScriptSlideshow Parse Error null 17 #anvsoftJavaScriptSlideshow Parse Error 53); 17 #anvsoftJavaScriptSlideshow Parse Error ;} and a note that 53 is "out of range" though the spec says 1-100...Without the opacity clause, I get a green light. What is wrong with opacity? Possibly a DOCTYPE issue? (I need to convert doctype anyway, I get a body onLoad error in HTML, but when I switch to a different doctype I have a lot of other grammar changes to make, so i have not yet addreessed the issue.)

Link to comment
Share on other sites

I think the problem is with the "filter:alpha(opacity:53)"First of all, "filter" is exclusively a Microsoft thing so it wouldn't validate, the second thing is that the syntax for Microsoft's opacity is alpha(opacity=53) The actual W3C opacity property takes values between 0.0 and 1.0 so 53 would definitely be out of range.

Link to comment
Share on other sites

I got that version of the command here: http://www.w3schools.com/css/css_image_transparency.asp (and when I change the syntax to opacity=53, the checker generates an additional error.) But I tried without the filter command and newer IE still plays correctly - and the checker is happy. Would not have thought to try just half the command, but it's good. Thanks.

Link to comment
Share on other sites

Filter is still required, though, if you want it to work in older versions of Internet Explorer. It just won't validate as proper CSS. Don't worry about the validator.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...