如果你點擊這個鏈接讓我輸入元素右對齊
http://jaminweb.com/boardBeta.php
然後單擊新主題,你會看到text
型3個input
元素,用戶名右邊,密碼和標題,分別。我希望這些元素在它們的直接父項div
(帶灰色背景的框)中右對齊,或者使它們彼此對齊的一些替代方式。我不喜歡他們看起來正對着左邊的文字。我已經嘗試了幾種完成上述任務的技巧,但都沒有成功。
下面是相關代碼:
div.boardbox
{
background-color: #ccc;
margin: 20px;
width: 50%;
padding: 5px;
border: 3px solid #00325f;
}
div.hidden
{
display: none;
}
input.threadipt
{
width: 300px;
margin-left: auto;
margin-right: 0px;
}
textarea#newthreadtxt
{
height: 400px;
width: 100%;
margin: 0px;
}
button.threadbutton
{
width: 100px;
background-color: #DF0101;
}
和
<button onclick="$('#newthreaddiv').removeClass('hidden');">New Thread</button>
<div class="boardbox hidden" id="newthreaddiv">
<form id="newthreadform">
<p>Username: <input class="threadipt" type="text"/></p>
<p>Password: <input class="threadipt" type="text"/></p>
<p>Title: <input class="threadipt" type="text"/></p>
<p>Content:</p>
<textarea id="newthreadtxt"></textarea>
<button onlick="phpfunction">Create Thread</button>
</form>
</div>
另外,我想這textarea
元素的div
內的中心位置,是唯一能夠垂直擴展。可能?