jQueryʹÓÃÊÖ²áÖ®CSS²Ù×÷
Jquery¶ÔcssµÄ²Ù×÷Ï൱·½±ã£¬Äܷܺ½±ãÎÒÃÇȥͨ¹ýjsÐÞ¸Äcss¡£´«Í³javascript¶ÔcssµÄ²Ù×÷Ï൱·±Ëö£¬±ÈÈç
<div id="a" style="background:blue">css</div>
È¡ËüµÄbackgroundÓï·¨ÊÇ£º
document.getElementById("a").style.background
¶øjQuery¶Ôcss¸ü·½±ãµÄ²Ù×÷£º
$("#a").background();$("#a").background(“red”)
˵Ã÷ÈçÏÂ
$("#a")µÃµ½jQuery¶ÔÏó[ <div id="a" … /div> ]
$("#a").background()½«È¡³ö¸Ã¶ÔÏóµÄbackgroundÑùʽ¡£
$("#a").background(“red”)½«¸Ã¶ÔÏóµÄbackgroundÑùʽÉèΪredjQueryÌṩÁËÒÔÏ·½·¨£¬À´²Ù×÷css:
background ()
background (val)
color()
color(val)
css(name)
css(prop)
css(key, value)
float()
float(val)
height()
height(val)
width()
width(val)
left()
left(val)
overflow()
overflow(val)
position()
position(val)
top()
top(val)
ÕâÀïÐèÒª½²½âÒ»ÏÂcss(name);css(prop);css(key, value)£¬ÆäËûµÄ¿´Ãû×Ö¶¼ÖªµÀʲô×÷ÓÃÁË£¡
<div id="a" style="background:blue; color:red">css</div><P id="b">test</P>
css(name):»ñÈ¡ÑùʽÃûΪnameµÄÑùʽ
$("#a").css("color"):½«µÃµ½ÑùʽÖÐcolorÖµred£¬("#a").css("background ")½«µÃµ½blue
css(prop):propÊÇÒ»¸öhash¶ÔÏó£¬ÓÃÓÚÉèÖôóÁ¿µÄcssÑùʽ
$("#b").css({ color: "red", background: "blue" });
×îÖÕЧ¹ûÊÇ
<p id="b" style="background:blue; color:red">test</p>
{ color: "red", background: "blue" }£¬hash¶ÔÏó£¬colorΪkey£¬"red"Ϊvalue£¬
css(key, value) ÓÃÓÚÉèÖÃÒ»¸öµ¥¶ÀµÃcssÑùʽ
$("#b").css("color","red");
×îÖÕЧ¹ûÊÇ
<p id="b" style="color:red">test</p>
Ïà¹ØÎĵµ£º
position:relativeÔÚcssÉè¼ÆÖÐÓÐמÓסÇáÖصÄ×÷Óã¬Èç¹ûÄ㻹ûÓÐÓùýËüÄÇôÕæÊǾ޴óµÄÒź¶£¬ÒÔÇ°×ö¹ýdiv titleÌáʾ¿òµÄʱºòÓиö¼ýÍ·¶¨Î»ÎÊÌ⣬µ±Ê±µÄ½â¾ö°ì·¨¾ÍÊǶàÌ×ÓÃÒ»²ãdiv²¢ÇÒÁô°×Ò»¶¨´óС£¬ÓÃÀ´±³¾°ÏÔʾ¼ýÍ·£¬µ«ÊÇ·¢ÏÖ¼ýÍ·ÓÀÔ¶ÔÚÏÂÃ棬ûÓа취ÕÚ¸Ç
Ö÷ÌåÈںϵIJ¿·Ö
£¬ËùÒÔЧ¹ûÒ²¾Í²»ºÃ£¬µ±È»£¬´ÏÃ÷µÄÄ ......
1.Çø±ðIEºÍFirefox
.title {
background:blue; /*Firefox */
background:red \9; /*IE6¡¢IE7¡¢IE8*/
}
2.Çø±ðIE6¡¢IE7¡¢IE8¡¢Firefox
.title {
background:blue; /*Firefox */
background:red \9; /*IE6¡¢IE7¡¢IE8 */
*background:black; /*IE7 */
_background:orange; /*IE6 */
}
×¢Ò⣬ÎÞÂÛÔõÑù£¬¶¼ÊÇFireFox ......
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Ë«É«±í¸ñCSSʵÀý</title>
<style type="text/css">
#DataGrid1 tr {
background-color: expression(
this.sectio ......
½ñÌìдÁËÒ»¸ö¼òµ¥µÄÍøÒ³£¬Çë¿´´úÂ룺´íÎóµÄ£º
½áÂÛ£º relÊÇRelationsµÄËõд Ö¸¹ØÁªµ½Ò»¸östylesheet£¨Ñùʽ±íµ¥) ÔÚ±êÇ©ÖУ¬“rel=stylesheet”£¬relÊǹØÁªµÄÒâ˼£¬¹ØÁªµÄÊÇÒ»¸öÑùʽ±í(stylesheet)Îĵµ£¬Ëü±íʾÕâ¸ölinkÔÚÎĵµ³õʼ»¯Ê±½«±»Ê¹Óá£ÇмÉ©дrel,·ñÔòÒýÈëµÄCSSÎÞЧ£¡ ......
ÔÚ˵µ½Õâ¸öÎÊÌâµÄʱºò£¬Ò²ÐíÓÐÈË»áÎÊCSSÖв»ÊÇÓÐvertical-alignÊôÐÔÀ´ÉèÖô¹Ö±¾ÓÖеÄÂ𣿼´Ê¹ÊÇijЩä¯ÀÀÆ÷²»Ö§³ÖÎÒÖ»Ðè×öÉÙÐíµÄCSS Hack¼¼Êõ¾Í¿ÉÒÔ°¡£¡ËùÒÔÔÚÕâÀïÎÒ»¹Òª啰àÂÁ½¾ä£¬CSSÖеÄÈ·ÊÇÓÐvertical-alignÊôÐÔ£¬µ«ÊÇËüÖ»¶Ô(X)HTMLÔªËØÖÐÓµÓÐvalignÌØÐÔµÄÔªËزÅÉúЧ£¬ÀýÈç±í¸ñÔªËØÖеģ¼td£¾¡¢£¼th£¾¡¢£¼caption£¾ ......