2016-03-31 530 views
0

我有問題固定div顯示內的元素的寬度作爲表,我意識到引起這個問題的標題,我試圖解決它沒有成功,在這裏是例如:固定在div顯示內的元素的寬度如表

這裏是代碼:

.row { 
 
    display:table; 
 
    border-spacing:10px; 
 
    width: 100%; 
 
    height: 100%; 
 
} 
 

 
.row-element { 
 
    display: table-cell; 
 
} 
 
.row-element input{ 
 
    width:100%; 
 
    line-height:20px; 
 
} 
 
.row-element label{ 
 
font-family: Arial, Helvetica, sans-serif; 
 
font-size: 12px; 
 
font-weight: bold; 
 
color: #2E2F3F; 
 
display: table-caption; 
 
white-space: nowrap; 
 
    width:100%; 
 
    box-sizing:border-box; 
 
}
<div class="row"> 
 
    <div class="row-element"> 
 
    <label>Name#<span class="mandatory"> *</span></label> 
 
\t <input data="true" type="text" class="textfield error" title="Name" minlength="5" maxlength="15" message="Insert Your Name !" name="NAME_FIELD" mandatory=""> 
 
\t \t \t \t \t </div> 
 
\t \t \t \t \t <div class="row-element"><label>Outside Label &gt; <span class="mandatory"> *</span></label> 
 
\t \t \t \t \t 
 
\t \t \t \t \t <input data="true" type="text" class="textfield error" minlength="5" maxlength="15" message="Insert Your Name !" name="NAME_FIELD" mandatory=""> 
 
\t \t \t \t \t </div> 
 
<div class="row-element"> 
 
    <label>custom_mandatory text#<span class="mandatory"> (Please Specify)</span></label> 
 
    <input data="true" type="text" class="textfield error" mandatory-text="(Please Specify)" title="custom mandatory text" message="Insert Your Name !" name="NAME_FIELD" mandatory=""> 
 
\t </div> \t \t \t \t \t 
 
</div>

+0

這裏是我的例子:http://codepen.io/pen/vGeBKN – arefedrees

+0

目前還不清楚什麼是理想的結果 – bumpy

+0

如果你打開我的第一條評論中提及的鏈接,你會看到輸入不一樣,每個元素都有相同的寬度,這是問題顛簸 – arefedrees

回答

0

這是你以後在做什麼?我添加了到row和一些任意寬度到row-element

.row { 
 
    display:table; 
 
    border-spacing:10px; 
 
    width: 100%; 
 
    height: 100%; 
 
    table-layout: fixed; 
 
} 
 

 
.row-element { 
 
    display: table-cell; 
 
    width: 100px; 
 
} 
 
.row-element input{ 
 
    width:100%; 
 
    line-height:20px; 
 
} 
 
.row-element label{ 
 
font-family: Arial, Helvetica, sans-serif; 
 
font-size: 12px; 
 
font-weight: bold; 
 
color: #2E2F3F; 
 
display: table-caption; 
 
white-space: nowrap; 
 
    width:100%; 
 
    box-sizing:border-box; 
 
}
<div class="row"> 
 
    <div class="row-element"> 
 
    <label>Name#<span class="mandatory"> *</span></label> 
 
\t <input data="true" type="text" class="textfield error" title="Name" minlength="5" maxlength="15" message="Insert Your Name !" name="NAME_FIELD" mandatory=""> 
 
\t \t \t \t \t </div> 
 
\t \t \t \t \t <div class="row-element"><label>Outside Label &gt; <span class="mandatory"> *</span></label> 
 
\t \t \t \t \t 
 
\t \t \t \t \t <input data="true" type="text" class="textfield error" minlength="5" maxlength="15" message="Insert Your Name !" name="NAME_FIELD" mandatory=""> 
 
\t \t \t \t \t </div> 
 
<div class="row-element"> 
 
    <label>custom_mandatory text#<span class="mandatory"> (Please Specify)</span></label> 
 
    <input data="true" type="text" class="textfield error" mandatory-text="(Please Specify)" title="custom mandatory text" message="Insert Your Name !" name="NAME_FIELD" mandatory=""> 
 
\t </div> \t \t \t \t \t 
 
</div>

+0

哇,它的工作完美:D,非常感謝你bumby,讚賞 – arefedrees

相關問題