2017-09-27 139 views
-2

当我将我的元素设置为显示时:CSS中的table-caption:它将它放在标签旁边。有没有办法将它保持在底部?CSS显示:表格标题

input, #number{ 
 
    display: table-cell; 
 
} 
 
#examples{ 
 
    background: red; 
 
    width: 100%; 
 
    position: absolute; 
 
    left: 0; 
 
}
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/> 
 
<div class="input-group col-md-6"> 
 
<label class="input-group-addon" id="number">Number</label> 
 
<input type="text" class="form-control" required></input> 
 
<ul id="examples"> 
 
    <li>111 111</li> 
 
    <li> 11 11 11</li> 
 
</ul> 
 

 
</div> 
 

 
<div class="input-group col-md-6"> 
 
<label class="input-group-addon" id="number">Postal code</label> 
 
<input type="text" class="form-control" required></input> 
 
</div>

+0

为什么你需要'表caption'到底是什么? –

+0

为什么在关闭“

”之前不要把你的'
+0

因为这正是它应该做的。 – FluffyKitten

回答

2

我不明白,为什么这里需要一个表格布局,但table-caption可以caption-side

caption-side CSS属性,将一个表的<caption>上的内容一起走指定的一面。这些值是相对于表格的writing-mode

input, 
 
#number { 
 
    display: table-cell; 
 
} 
 

 
.input-group { 
 
/* display:table; *//* or table-row can be set here if needed */ 
 
} 
 

 
#examples { 
 
    background: red; 
 
    margin: 0 1em; 
 
    display: table-caption; 
 
    caption-side: bottom; 
 
}
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/> 
 
<div class="input-group col-md-6"> 
 
<label class="input-group-addon" id="number">Number</label> 
 
<input type="text" class="form-control" required/> 
 
<ul id="examples"> 
 
    <li>111 111</li> 
 
    <li> 11 11 11</li> 
 
</ul> 
 

 
</div> 
 

 
<div class="input-group col-md-6"> 
 
<label class="input-group-addon" id="number">Postal code</label> 
 
<input type="text" class="form-control" required/> 
 
</div>