2013-08-27 152 views
0

我試圖製作一個像頁面的終端外殼。在輸入和輸出區域之間有不同的線條高度

見我的代碼在的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=""; 
}; 

回答

2

輸入了一些填充。添加

padding:0px; 
margin-left:-1px; 

到輸入CSS

+0

謝謝你的回答,但這似乎並沒有解決問題,按回車鍵,你會看到輸入行距離輸出還有點遠。 – user1150125

+0

它解決了行高問題,但不是輸入更靠右的問題。我會看看如果我能找到解決問題的方法 –

+0

現在看看我的帖子。這解決了它 –

0

確定。 我得到它通過iutput格設置保證金= 0輸入欄,邊距= 0終於sovled,和下邊距= 0輸出格:

#output { margin-bottom: 0px; background-color: #000000; } 
#input { margin-top: 0px; background-color: #000000; } 

input { 
    border: 0; 
    background: #000000; 
    color: #00FF00; 
    outline: none; 
    font-family:'Rosario', sans-serif; 
    font-size: 16px; 
    padding: 0px; 
    margin-left: -0.1px; 
    margin: 0px; 
} 

感謝約翰的幫助!

相關問題