If jQuery CSS
If jQuery css - if statement and adding CSS with jQuery.
If jQuery css. If a specific ID is not present on the page, jQuery writes something in the head section. If the ID is present, jQuery adds some CSS to the body tag.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
if(!$('#mySpecificID').length){
$('head').append('<!--[if lte IE 6]><style type="text/css">.myClass{color:#f00;background:#0ff;}</style><![endif]-->');
};
if($('#mySpecificID').length){
$('body').css('color','#0f0');
$('.myClass').css({'color':'#f0f','background':'#00f'});
};
});
</script>
2011.
Web Development - XHTML CSS JavaScript jQuery.