CSS选择器中的大写HTML标记
在查看一个网站的源代码时,我遇到了一个IMG标记,我想他们为什么不在CSS文件中使用IMG。接下来我回顾了javavscript代码,并看到IMG也都是大写的。所讨论的代码适用于此网站上的jquery滑块: 所讨论的CSS是:CSS选择器中的大写HTML标记,html,css,css-selectors,Html,Css,Css Selectors,在查看一个网站的源代码时,我遇到了一个IMG标记,我想他们为什么不在CSS文件中使用IMG。接下来我回顾了javavscript代码,并看到IMG也都是大写的。所讨论的代码适用于此网站上的jquery滑块: 所讨论的CSS是: /* Slide show */ #slideshow {position:relative;height:300px;} #slideshow IMG {position:absolute;top:32px;left:0;z-index:8;opacity:0.0;
/* Slide show */
#slideshow {position:relative;height:300px;}
#slideshow IMG {position:absolute;top:32px;left:0;z-index:8;opacity:0.0;
border-top-left-radius:10px;border-bottom-right-radius:10px;}
#slideshow IMG.active {z-index:10;opacity:1.0;}
#slideshow IMG.last-active {z-index:9;}
Javascript是这样的:
function slideSwitch() {
var $active = $('#slideshow IMG.active');
if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
// use this to pull the images in the order they appear in the markup
var $next = $active.next().length ? $active.next()
: $('#slideshow IMG:first');
$active.addClass('last-active');
$next.css({opacity: 0.0})
.addClass('active')
.animate({opacity: 1.0}, 1000, function() {
$active.removeClass('active last-active');
});
}
css和javascript所指的HTML片段如下:
<!-- mast slideshow -->
<div id="slideshow">
<img src="home/mast_1.jpg" alt="Slideshow Image 1" class="active" />
<img src="home/mast_2.jpg" alt="Slideshow Image 2" />
<img src="home/mast_3.jpg" alt="Slideshow Image 3" />
</div>
我的问题是:
一个深入的回答,为前端编程的相对新手提供了见解。