這裏是我的HTML代碼的一部分:如何在某一類在CSS選擇特定的位置元素
<label>
Work Address:
</label>
<input type="text" id="workAddress0" name="workAddress0">
<input type="button" value="+" class="btn btn-small" onclick="ui.createTextfield('work')"><br>
<label>
Hobby Address:
</label>
<input type="text" id="hobbyAddress0" name="hobbyAddress0">
<input type="button" value="+" class="btn btn-small" onclick="ui.createTextfield('hobby')"><br>
我的CSS是:
.btn.btn-small:first-of-type{
position: absolute;
left: 953px;
top:290px;
height: 40px;
text-align: center;
}
.btn.btn-small:nth-of-type(2){
position: absolute;
left: 953px;
top:337px;
height: 40px;
text-align: center;
}
我想設置的第一個按鈕頂部290px和第二個按鈕頂部337px;但是這個選擇不起作用。你能告訴我如何認識到這一點嗎?我想單獨選擇這個類的第一個和第二個(btn btn-small)。預先感謝您
可能是你有問題,由於位置是:絕對的; http://www.w3schools.com/cssref/pr_class_position.asp –