我想在現代瀏覽器中顯示舊的HTML2。 (糟糕的)HTML3代碼包含字體的 HTML元素,大小的屬性。文本的大小以像素爲單位定義,因此size =「14」表示用戶希望文本的大小爲14px。字體大小屬性不是以像素爲單位?
W3School文檔指定size屬性的有效值只能是「1,2,3,4,5,6,7,+ 1,+ 2,+ 3,+ 4,+ 5, + 6,+ 7,-1,-2,-3,-4,-5,-6,-7" 。所以看起來字體大小屬性單位不是像素,而是em或什麼的?
有沒有辦法讓字體元素以像素爲單位顯示字體文本大小?
我曾嘗試以下,但他們不以Safari瀏覽器工作:
<font size="14">test</font> // displays in huge text(its not 14px in font size)
<font size="14px">test</font> // looks the same as line 1
<font size="14pt">test</font> // looks the same as line 1
<font size="14em">test</font> // On Firefox the font size is 14px(correct) but on Safari it looks the same as line 1
<font size="14%">test</font> // looks the same as line 1
也許如果我試圖改變HTML文件它會讀取HTML3代碼的DTD?
有沒有理由不能使用樣式屬性? '' – Lee