1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Test</title>
<script type="text/javascript">//<![CDATA[
function CSS_PropertyValue(oElem,property){
var docStyle='';
if(window.getComputedStyle){
docStyle=document.defaultView.getComputedStyle(oElem,null).getPropertyValue(property);
}
else if(oElem.currentStyle){
docStyle=oElem.currentStyle[property];
}
return docStyle;
}
function showFontSizes(){
var
s='',
ctc,
FontSize,
colecspan=document.getElementsByTagName('span');
for(ctc=0;ctc<colecspan.length;ctc++){
FontSize=CSS_PropertyValue(colecspan[ctc],'fontSize');
s+=(ctc+1)+' : '+FontSize+'<br />';
}
document.getElementById('rpt').innerHTML=s;
}
window.onload=showFontSizes;
//]]>
</script>
</head>
<body>
<p style="font-size:12px">
1 : <span>Valeur par défaut : 12px</span><br />
2 : <span style="font-size:10px">10 px</span><br />
3 : <span style="font-size:12px">12 px</span><br />
4 : <span style="font-size:14px">14 px</span><br />
5 : <span style="font-size:1em">1 em</span><br />
6 : <span style="font-size:1.2em">1.2 em</span><br />
7 : <span style="font-size:1.4em">1.4 em</span>
</p>
<div id="rpt"></div>
</body>
</html> |