Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    137
    Thanks
    5
    Thanked 0 Times in 0 Posts

    CSS Validation Fail

    When i try to validate CSS on

    http://harshamv.com

    http://jigsaw.w3.org/css-validator/v...arshamv.com%2F

    am getting errors

    Code:
    58  	 #rightnav  	 Property opacity doesn't exist in CSS level 2.1 but exists in [css3] :  0.25
    59 	#rightnav 	Property -moz-opacity doesn't exist : 0.25
    60 	#rightnav 	Parse Error opacity=25)

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Opacity is a CSS3 property, and the validator validates under CSS2.1.

    You might want to resort on using JS instead:
    Code:
    <script type="text/javascript">
    window.addEventListener?window.addEventListener('load',opacity,false):
    window.attachEvent('onload',opacity); // FF : IE
    
    function opacity() {
    	var el = document.getElementById('rightnav'); // rightnav div
    	el.style.opacity = 0.25;
    	el.style.filter = 'alpha(opacity=25)'; // IE
    }
    </script>
    You might also find this thread useful:
    http://www.codingforums.com/showthread.php?t=121004
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #3
    Regular Coder
    Join Date
    Jan 2007
    Posts
    137
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rangana View Post
    Opacity is a CSS3 property, and the validator validates under CSS2.1.

    You might want to resort on using JS instead:
    Code:
    <script type="text/javascript">
    window.addEventListener?window.addEventListener('load',opacity,false):
    window.attachEvent('onload',opacity); // FF : IE
    
    function opacity() {
    	var el = document.getElementById('rightnav'); // rightnav div
    	el.style.opacity = 0.25;
    	el.style.filter = 'alpha(opacity=25)'; // IE
    }
    </script>
    You might also find this thread useful:
    http://www.codingforums.com/showthread.php?t=121004
    Thanx. is it advisable to use Js instead of the browser specific css propertites ?

  • #4
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    JS should be used only to enhance the page, and shouldn't cripple your page when users have JS disabled.

    Opactiy, will only validate if you click on the "More Options" link and choose CSS3 for the Profile.

    Hope that helps.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #5
    Regular Coder
    Join Date
    Jan 2007
    Posts
    137
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rangana View Post
    Opacity is a CSS3 property, and the validator validates under CSS2.1.

    You might want to resort on using JS instead:
    Code:
    <script type="text/javascript">
    window.addEventListener?window.addEventListener('load',opacity,false):
    window.attachEvent('onload',opacity); // FF : IE
    
    function opacity() {
    	var el = document.getElementById('rightnav'); // rightnav div
    	el.style.opacity = 0.25;
    	el.style.filter = 'alpha(opacity=25)'; // IE
    }
    </script>
    You might also find this thread useful:
    http://www.codingforums.com/showthread.php?t=121004

    should this go in to the head or body for better results ?

  • #6
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Place it on the head.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •