Block element ¿é¼¶ÔªËØ
¹ËÃû˼Òå¾ÍÊÇÒÔ¿éÏÔʾµÄÔªËØ£¬¸ß¶È¿í¶È¶¼ÊÇ¿ÉÒÔÉèÖõġ£±ÈÈçÎÒÃdz£ÓõÄ<div>¡¢<p>¡¢<ul>ĬÈÏ״̬϶¼ÊÇÊôÓڿ鼶ԪËØ¡£¿é¼¶ÔªËرȽϰԵÀ£¬Ä¬ÈÏ״̬ÏÂÿ´Î¶¼Õ¼¾ÝÒ»Õû¸öÐУ¬ºóÃæµÄÄÚÈÝÒ²±ØÐëÔÙÐÂÆðÒ»ÐÐÏÔʾ¡£µ±È»·Ç¿é¼¶ÔªËØÒ²¿ÉÒÔͨ¹ýcssµÄdisplay:block;½«Æä¸ü¸Ä³É¿é¼¶ÔªËØ¡£´ËÍ⻹ÓиöÌØÊâµÄ£¬floatÒ²¾ßÓд˹¦ÄÜ¡£
Inline element ÄÚÁªÔªËØ
ͨË×µãÀ´Ëµ¾ÍÊÇÎı¾µÄÏÔʾ·½Ê½£¬Óë¿é¼¶ÔªËØÏà·´£¬ÄÚÁªÔªËصĸ߶ȿí¶È¶¼ÊDz»¿ÉÒÔÉèÖõģ¬Æä¿í¶È¾ÍÊÇ×ÔÉíÎÄ×Ö»òÕßͼƬµÄ¿í¶È¡£ÎÒÃdz£Óõ½µÄ<a>¡¢<span>¡¢<em>¶¼ÊôÓÚÄÚÁªÔªËØ¡£ÄÚÁªÔªËصÄÏÔʾÌصã¾ÍÊÇÏñÎı¾Ò»ÑùµÄÏÔʾ£¬²»»á¶À×ÔÕ¼¾ÝÒ»¸öÐС£µ±È»¿é¼¶ÔªËØÒ²Äܱä³ÉÄÚÁªÔªËØ£¨±¾ÎÄΪתÔØ£¬¸öÈËÈÏΪ·Ç¾ø¶ÔÒâÒåÉϵÄÄÚÁª£©£¬ÄǾÍÊÇͨ¹ýcssµÄdisplay:inline;ºÍfloatÀ´ÊµÏÖ¡£
ÔÚ¡¶CSSȨÍþÖ¸ÄÏ¡·ÕâÑù¶¨Òåµ½£¬“Èκβ»Êǿ鼶ԪËصĿɼûÔªËض¼ÊÇÄÚÁªÔªËØ£¬Æä±íÏÖµÄÌØÐÔÊÇ“Ðв¼¾Ö”ÐÎʽ¡£”ÎÒ¸öÈ˲»Ì«Ï°¹ß“Ðв¼¾Ö”µÄ˵»°£¬ÒòΪÎÒÈÏΪ¿é¼¶ÔªËØ´Ó±íÏÖÉϸüÏñ“ÐДÏÔʾ ......
ÎÄÕÂÀ´×Ô£ºhttp://mayer.vokaa.com/archives/16
¶ÔÓÚÒ»¸öÇ°¶Ë¹¤×÷Õߣ¬¶¼ÖªµÀ·ûºÏW3C¹æ·¶¶ÔÓÚÍøÒ³µÄ¿çä¯ÀÀÆ÷¹¤×÷´øÀ´ºÃ´¦£¬²¢ÄÜʹÍøÒ³ÔÚ²»Í¬µÄä¯ÀÀÆ÷Ö®¼ä»¥Ïà¼æÈÝ¡£
ÔÚÕâÀïÎÒÃÇÒ»Ò»Áоٻ¥ÁªÍøÉÏËùÌṩµÄ½â¾ö°ì·¨¼°Ò»Ð©ÎÒ¸öÈ˵Ľ¨Ò鼰ʵ¼ù°¸Àý¡£
Æäʵ£¬ÏÖÔÚ¶àÊýÈ˶¼»áʹÓÃHackµÄ·½·¨½â¾ö£¬µ«Èç¹ûDIVºÍCSSµÄ½á¹¹ÇåÎú¡¢ºÏÀí£¬¿ÉÄÜÎÒÃǸù±¾²»ÐèÒªÕâЩHack¡£
Ò»¡¢DOCTYPE ¶ÔCSS´¦ÀíËù´øÀ´µÄÓ°Ïì
Ñϸñģʽ£¨strict£©µÄHTML 1.0 ¹æ·¶£¬Ê¹ÓÃʱä¯ÀÀÆ÷½«Ïà¶ÔÑϸñ£¬²»ÔÊÐíʹÓÃÈκαíÏÖÐÎʽµÄ±êʶºÍÊôÐÔ£¬ÈçÔÚÔªËØÖÐÖ±½ÓʹÓÃbgcolor±³¾°É«ÊôÐԵȡ£
1
<!doctype html public "-/w3c/dtd xhtml 1.0 strict/en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd">
¹ý¶Èģʽ£¨transitional£©µÄHTML 1.0 ¹æ·¶£¬ÊÇÖ¸Ò»ÖÖ¹ý¶ÉÀàÐÍ£¬Ê¹ÓÃÕâÖÖÀàÐÍä¯ÀÀÆ÷¶ÔXHTMLµÄ½âÎö±È½Ï¿íËÉ£¬ÔÊÐíʹÓÃHTML4.01ÖеıêÇ©£¬µ«±ØÐë·ûºÏXHTMLµÄÓï·¨¡£
1
<!doctype html public "-/w3c/dtd xhtml 1.0 transitional/en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
& ......
ÎÄÕÂÀ´×Ô£ºhttp://mayer.vokaa.com/archives/16
¶ÔÓÚÒ»¸öÇ°¶Ë¹¤×÷Õߣ¬¶¼ÖªµÀ·ûºÏW3C¹æ·¶¶ÔÓÚÍøÒ³µÄ¿çä¯ÀÀÆ÷¹¤×÷´øÀ´ºÃ´¦£¬²¢ÄÜʹÍøÒ³ÔÚ²»Í¬µÄä¯ÀÀÆ÷Ö®¼ä»¥Ïà¼æÈÝ¡£
ÔÚÕâÀïÎÒÃÇÒ»Ò»Áоٻ¥ÁªÍøÉÏËùÌṩµÄ½â¾ö°ì·¨¼°Ò»Ð©ÎÒ¸öÈ˵Ľ¨Ò鼰ʵ¼ù°¸Àý¡£
Æäʵ£¬ÏÖÔÚ¶àÊýÈ˶¼»áʹÓÃHackµÄ·½·¨½â¾ö£¬µ«Èç¹ûDIVºÍCSSµÄ½á¹¹ÇåÎú¡¢ºÏÀí£¬¿ÉÄÜÎÒÃǸù±¾²»ÐèÒªÕâЩHack¡£
Ò»¡¢DOCTYPE ¶ÔCSS´¦ÀíËù´øÀ´µÄÓ°Ïì
Ñϸñģʽ£¨strict£©µÄHTML 1.0 ¹æ·¶£¬Ê¹ÓÃʱä¯ÀÀÆ÷½«Ïà¶ÔÑϸñ£¬²»ÔÊÐíʹÓÃÈκαíÏÖÐÎʽµÄ±êʶºÍÊôÐÔ£¬ÈçÔÚÔªËØÖÐÖ±½ÓʹÓÃbgcolor±³¾°É«ÊôÐԵȡ£
1
<!doctype html public "-/w3c/dtd xhtml 1.0 strict/en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd">
¹ý¶Èģʽ£¨transitional£©µÄHTML 1.0 ¹æ·¶£¬ÊÇÖ¸Ò»ÖÖ¹ý¶ÉÀàÐÍ£¬Ê¹ÓÃÕâÖÖÀàÐÍä¯ÀÀÆ÷¶ÔXHTMLµÄ½âÎö±È½Ï¿íËÉ£¬ÔÊÐíʹÓÃHTML4.01ÖеıêÇ©£¬µ«±ØÐë·ûºÏXHTMLµÄÓï·¨¡£
1
<!doctype html public "-/w3c/dtd xhtml 1.0 transitional/en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
& ......
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>ÎÞ±êÌâÒ³</title>
<LINK href="../css/skin1.css" mce_href="css/skin1.css" rel="stylesheet" type="text/css">
<mce:script language="JavaScript" type="text/javascript"><!--
function changeSkin(n){
if(n==1)
document.styleSheets(0).href = "../css/skin1.css";
if(n==2)
document.styleSheets(0).href = "../css/skin2.css";
if(n==3)
document.styleSheets(0).href = "../css/skin3.css";
}
// --></mce:script>
</head>
<body>
<div>
[<A onclick="changeSkin(1)" style="cursor:hand" mce_style="cursor:hand">ÌìÀ¶°×ÔÆ</A>]
[<A onclick="changeSkin(2)" style="cursor:hand" mce_style="cursor:hand">·Ûºì»ØÒä</A>]
[<A onclick="changeSkin(3)" style="cursor:hand" mce_style="cursor:hand">ÐǹâÕÕÒ«</A>]
</div>
</body>
</html> ......
Ò»¡¢ ÉÆÓÃcssËõд¹æÔò
/*×¢ÒâÉÏ¡¢ÓÒ¡¢Ï¡¢×óµÄÊéд˳Ðò*/
1. ¹ØÓڱ߾ࣨ4±ß£©£º
1px 2px 3px 4px (ÉÏ¡¢ÓÒ¡¢Ï¡¢×ó)
1px 2px 3px £¨Ê¡ÂÔµÄ×óµÈÓÚÓÒ£©
1px 2px (Ê¡ÂÔµÄÉϵÈÓÚÏÂ)
1px £¨Ëı߶¼Ïàͬ£©
2. ¼ò»¯ËùÓУº
*/ body{margin:0}------------±íʾÍøÒ³ÄÚËùÓÐÔªËصÄmarginΪ0
#menu{ margin:0}------------±íʾmenuºÐ×ÓϵÄËùÓÐÔªËصÄmarginΪ0
3. Ëõд£¨border£©Ìض¨Ñùʽ£º
Border:1px solid #ffffff;
Border-width:0 1px 2px 3px;
4. ¹ØÓÚÎÄ×ÖµÄËõд¹æÔò£º
Font-style:italic; бÌåÐÎʽ
Font-variant:small-caps/normal; ±äÌåÑùʽ£ºÐ¡ÐÍ´óд×Öĸ/Õý³£
Font-weight:bold;
Font-size:12px;
Line-height:1.2em(120%)/1.5em(150%);
Font-family:arrial,sans-serif,verdana;
Ëõд³É£º ......
×¢£º"elm"´ú±íij¸öDOMÔªËØ£¬"xxx"´ú±íij¸öCSSÊôÐÔ
Ò»¡¢elm.style.xxx Ö»ÄÜ»ñÈ¡ÄÚÁªÑùʽÀïµÄÖµ
ÒªÏë»ñµÃÕýÈ·µÄcssÖµ£º
IE£ºelm.currentStyle[xxx]
W3C±ê×¼£ºdocument.defaultView.getComputedStyle(elm,"")[xxx]
×¢Ò⣺ÓÃIE·½·¨·µ»ØÖµ¿ÉÄܲ»ÊÇÊý×Ö£¬¶øÊÇauto£»ÓÃw3cµÄ·½·¨×ÜÊǻ᷵»ØÊý×Ö+µ¥Î»
Èý¡¢offsetLeft
1.ä¯ÀÀÆ÷ÊÇ·ñ»á°ÑbodyµÄ¸÷¸öÊôÐÔÖµ(margin,padding,border)°üÀ¨ÔÚoffsetLeftÄÚ£¿
IE6/7IE8Firefox
margin-left
·ñ
ÊÇ
ÊÇ
padding-left
ÊÇ
ÊÇ
ÊÇ
border-left
·ñ
ÊÇ
·ñ
2.¸¸ÔªËصÄÊôÐÔÖµÒ²»á°üÀ¨ÔÚoffsetLeftÄÚ
3.¶ÔÓÚÔªËØ×ÔÉíµÄÊôÐÔÖµ£¬Ö»ÓÐmargin-left»á±»°üÀ¨ÔÚoffsetLeftÄÚ
4.ÔÚÔªËØ display:none Çé¿öÏ offsetLeft µÄÖµ£º IE6/7:-1 IE8/Firefox:0
5.visibility:hidden²»»áÓ°ÏìoffsetLeft
6.bodyµÄoffsetLeftÖµ:
A.IE6/7»á°ÑbodyµÄmargin-left°üÀ¨ÔÚÆäoffsetLeftÄÚ
B.ÈôbodyÓпí¶ÈΪxµÄ±ß¿ò(border)£¬ÔÚFirefoxÀïbodyµÄoffsetLeft»á±ä³É-x
ËÄ¡¢offsetTop
Çé¿öÓëoffsetLeftÒ»Ñù
Îå¡¢offsetWidthºÍoffsetHeight
ÔÚËùÓÐÖ÷Á÷ä¯ÀÀÆ÷ÀÕâÁ½¸öÊôÐ ......
×¢£º"elm"´ú±íij¸öDOMÔªËØ£¬"xxx"´ú±íij¸öCSSÊôÐÔ
Ò»¡¢elm.style.xxx Ö»ÄÜ»ñÈ¡ÄÚÁªÑùʽÀïµÄÖµ
ÒªÏë»ñµÃÕýÈ·µÄcssÖµ£º
IE£ºelm.currentStyle[xxx]
W3C±ê×¼£ºdocument.defaultView.getComputedStyle(elm,"")[xxx]
×¢Ò⣺ÓÃIE·½·¨·µ»ØÖµ¿ÉÄܲ»ÊÇÊý×Ö£¬¶øÊÇauto£»ÓÃw3cµÄ·½·¨×ÜÊǻ᷵»ØÊý×Ö+µ¥Î»
Èý¡¢offsetLeft
1.ä¯ÀÀÆ÷ÊÇ·ñ»á°ÑbodyµÄ¸÷¸öÊôÐÔÖµ(margin,padding,border)°üÀ¨ÔÚoffsetLeftÄÚ£¿
IE6/7IE8Firefox
margin-left
·ñ
ÊÇ
ÊÇ
padding-left
ÊÇ
ÊÇ
ÊÇ
border-left
·ñ
ÊÇ
·ñ
2.¸¸ÔªËصÄÊôÐÔÖµÒ²»á°üÀ¨ÔÚoffsetLeftÄÚ
3.¶ÔÓÚÔªËØ×ÔÉíµÄÊôÐÔÖµ£¬Ö»ÓÐmargin-left»á±»°üÀ¨ÔÚoffsetLeftÄÚ
4.ÔÚÔªËØ display:none Çé¿öÏ offsetLeft µÄÖµ£º IE6/7:-1 IE8/Firefox:0
5.visibility:hidden²»»áÓ°ÏìoffsetLeft
6.bodyµÄoffsetLeftÖµ:
A.IE6/7»á°ÑbodyµÄmargin-left°üÀ¨ÔÚÆäoffsetLeftÄÚ
B.ÈôbodyÓпí¶ÈΪxµÄ±ß¿ò(border)£¬ÔÚFirefoxÀïbodyµÄoffsetLeft»á±ä³É-x
ËÄ¡¢offsetTop
Çé¿öÓëoffsetLeftÒ»Ñù
Îå¡¢offsetWidthºÍoffsetHeight
ÔÚËùÓÐÖ÷Á÷ä¯ÀÀÆ÷ÀÕâÁ½¸öÊôÐ ......
The Lovely CSS Framework is a simple and straight forward way to easily
deploy an XHTML/CSS site.
Based on a simple 960px wide grid system, featuring multiple column layouts,
and various pluggable add-ons.
Õâ¸öÓÉ Constantinos Demetriadis ´´½¨µÄÏîÄ¿ÊÇÒ»¸ö CSS ¿ò¼Ü£¬»ùÓÚ 960.gs£¬»¹ÓµÓÐÒ»¸ö²å¼þ¿ÉÒÔÀ©³ä¸Ã¿ò¼Ü¡£1.0 °æ»ùÓÚ
MIT ÐÒ飬ÕâÀïÓиöÑÝʾ¡£
ÏÂÔØ£ºlovely-css-v1.0.zip ......
×ܼǼÊý:772; ×ÜÒ³Êý:129; ÿҳ6 Ìõ;
Ê×Ò³ ÉÏÒ»Ò³ [2] [3] [4] [5] 6
[7] [8] [9] [10] [11] ÏÂÒ»Ò³ βҳ