我想疊加在一個文本中的同一文本在文本中的文本。我已經設法使其在所有瀏覽器中都能正常工作,但FireFox(我使用的是8.0)。在FireFox中,textarea內部的文本左移了1px。文本框內的位置文本在FireFox
這裏是我的代碼:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
div, textarea
{
position:absolute;
top: 0px;
left: 0px;
margin: 0px;
padding: 0px;
font-family: Consolas;
font-size: medium;
border:none;
border-width: 0px;
}
div {color:red;}
textarea {color: blue;}
</style></head>
<body>
<textarea>Stuff</textarea>
<div>Stuff</div>
</body>
</html>
我想說這是Firefox呈現textareas的方式,所以你只需要Firefox的特殊CSS。 – Hossein
這顯然是一段時間的問題,因爲http://stackoverflow.com/questions/4374537/how-to-force-firefox-to-render-textarea-padding-the-same-as-in-a-div演示。在那裏沒有真正的解決方案。 – ScottS
看起來我必須恢復瀏覽器嗅探。就像在過去的美好時光一樣.. – ulu