我試圖製作一個像頁面的終端外殼。在輸入和輸出區域之間有不同的線條高度
見我的代碼在的jsfiddle:
http://jsfiddle.net/paopaomj/qGw4Q/9/
輸入線,似乎有更多的line-height然後輸出。 嘗試一下,輸入一些東西,按一些輸入你就會明白我的意思。
謝謝。
HTML:
<body>
<div id="output"></div>
<div id="input">
[email protected]
<input type="text" id="command" />
</div>
的javascript:
$("#command").keyup(function (e) {
if (e.keyCode == 13) {
submit();
}
});
var submit = function() {
var commandEl = document.getElementById("command");
var command = commandEl.value;
var outputel = document.getElementById("output");
var new_row = document.createElement("div");
new_row.innerHTML = "[email protected] " + command;
outputel.appendChild(new_row);
commandEl.value="";
};
謝謝你的回答,但這似乎並沒有解決問題,按回車鍵,你會看到輸入行距離輸出還有點遠。 – user1150125
它解決了行高問題,但不是輸入更靠右的問題。我會看看如果我能找到解決問題的方法 –
現在看看我的帖子。這解決了它 –