操作CSS方法集合

2021-04-21 10:10:54 字數 1356 閱讀 2452

//獲取元素的真實的,最終的css樣式屬性值的函式

function getstyle(elem,name)else if(elem.currentstyle)else if(document.defaultview && document.defaultview.getcomputedstyle)else

}//兩個確定元素相對於整個文件的x和y位置的輔助位置

function pagex(elem)

function pagey(elem)

//確定元素相對於父親的位置的兩個函式

function parentx(elem)

function parenty(elem)

//確定元素相對於它的css容器的位置

function posx(elem)

function posy(elem)

//設定元素x和y位置(與當前位置無關)的函式

function setx(elem,pos)

function sety(elem,pos)

//調整元素相對於當前位置的距離的函式

function addx(elem,pos)

function addy(elem,pos)

//獲取元素當前的高度和寬度

function getheight(elem)

function getwidth(elem)

//即是元素隱藏,也能分別獲取它潛在的完整高度和寬度的兩個函式

function fullheight(elem)

var old = resetcss(elem,);

var h = elem.clientheight||getheight(elem);

restorecss(elem,old);

return h;

}function fullwidth(elem)

var old = resetcss(elem,);

var w = elem.clientwidth || getwidth(elem);

restorecss(elem,old);

return w;

}function resetcss(elem,prop)

return old;

}function restorecss(elem,prop)

}//使用css的display屬性來切換元素可見性的一組函式

function hide(elem)

elem.style.display = 'none';

}function show(elem)

//設定元素的透明度

function setopacity(elem,level)else

}

CSS清除浮動方法集合

css清除浮動方法集合 一般浮動是什麼情況呢?一般是乙個盒子裡使用了css float浮動屬性,導致父級物件盒子不能被撐開,這樣css float浮動就產生了。浮動產生樣式效果截圖 本來兩個黑色物件盒子是在紅色盒子內,因為對兩個黑色盒子使用了float浮動,所以兩個黑色盒子產生了浮動,導致紅色盒子不...

CSS清除浮動方法集合

一般是乙個盒子裡使用了css float浮動屬性,導致父級物件盒子不能被撐開,這樣css float浮動就產生了。浮動產生樣式效果截圖 本來兩個黑色物件盒子是在紅色盒子內,因為對兩個黑色盒子使用了float浮動,所以兩個黑色盒子產生了浮動,導致紅色盒子不能撐開,這樣浮動就產生了。簡單地說,浮動是因為...

C 操作IIS方法集合

如果在win8,win7情況下報錯 未知錯誤 0x80005000 見using system using system.collections using system.collections.generic using system.directoryservices using system....