2017-10-14 115 views
-1

我正在嘗試使它成爲一個頁面,文本區域左對齊,文本區域右對齊。目前,我只能讓它與一個左對齊的工作。這是我的代碼到目前爲止。HTML:在屏幕的左側和右側有文本區域


div { 
 
    height: 90px; 
 
    line-height: 90px; 
 
    text-align: left; 
 
    border: 2px dashed #f69c55; 
 
    }
<div> 
 
    
 
    <h1 align = "center"> Chat Room </h1> 
 
    <form> 
 

 
    Chat <br> 
 
    <textarea rows="20" cols = "100"> </textarea> 
 
    <br> <br> 
 
    <input type="submit" value="Submit Chat"> 
 
    </form> 
 

 
    </div>

+0

其他textarea在哪裏?我只看到一個。 –

+0

我沒有在這裏,因爲我不知道如何正確實施它。 –

回答

0

您需要將以下CSS分配給textarea

display: inline-block; 
width: 48.5%; /* allowing for margin, paddings, outlines, etc. */ 

<!DOCTYPE html> 
 
<html> 
 

 
<body> 
 
<style> 
 
div { 
 
height: 90px; 
 
line-height: 90px; 
 
text-align: left; 
 
border: 2px dashed #f69c55; 
 
} 
 
textarea { 
 
    display: inline-block; 
 
    width: 48.5%; 
 
} 
 
</style> 
 

 
<div> 
 

 
<h1 align = "center"> Chat Room </h1> 
 
<form> 
 

 
Chat <br> 
 
<textarea rows="20" cols = "100"> </textarea> 
 
<textarea rows="20" cols = "100"> </textarea> 
 
<br> <br> 
 
<input type="submit" value="Submit Chat"> 
 
</form> 
 

 
</div>

0
<style> 
.. 
#tx1{ 
float: left; 
} 
#tx2{ 
float: right; 
} 
</style> 
.. 
<textarea id="tx1" rows="20" cols = "100"> </textarea> 
<textarea id="tx2"rows="20" cols = "100"> </textarea> 

缺少第二個文本區域?

相關問題