我试图使用flexbox将文本置于圆形div下,但我无法弄明白。我的目标是在圆圈中放置带有文字的图标作为标题,但是h2最终在圆圈旁边,我无法弄清楚如何将它放在圆圈的底部。谢谢你的帮助!
html,
body {
margin: 0;
padding: 0;
width: 100%;
}
.flex-container {
display: flex;
flex-wrap: wrap;
width: 1000px;
align-content: space-between;
align-tems: center;
justify-content: center;
position: absolute;
}
.circle {
border-radius: 50%;
background: #252525;
width: 150px;
height: 150px;
border: 10px solid #69bf4a;
margin: 20px;
}
.flex-container>div:hover {
background-color: #69bf4a;
}
h2 {
position: absolute;
display: inline;
flex-direction: column;
justify-content: flex-start;
}

<div class="flex-container">
<div class="circle"></div>
<div>
<h2>T-SHIRTS</h2>
</div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
&#13;
答案 0 :(得分:1)
您不能在弹性框视图中包含任意元素。所以我建议你给每个flex元素一个包装器:
<div class="flex-wrap">
<div class="circle"></div>
<div><h2>T-SHIRTS</h2></div>
</div>
现在,回到样式,如果你希望它们具有相同的大小,请使用这种方式:
html, body {
margin: 0;
padding: 0;
}
.flex-container {
display: flex;
flex-wrap: wrap;
width: 1000px;
align-content: space-between;
align-items: top;
justify-content: center;
}
.circle {
border-radius: 50%;
background: #252525;
width: 150px;
height: 150px;
border: 10px solid #69bf4a;
margin: 20px;
}
.flex-container > div:hover {
background-color: #69bf4a;
}
h2 {
text-align: center;
}
&#13;
<div class="flex-container">
<div class="flex-wrap">
<div class="circle"></div>
<div><h2>T-SHIRTS</h2></div>
</div>
<div class="flex-wrap">
<div class="circle"></div>
</div>
<div class="flex-wrap">
<div class="circle"></div>
</div>
<div class="flex-wrap">
<div class="circle"></div>
</div>
<div class="flex-wrap">
<div class="circle"></div>
</div>
<div class="flex-wrap">
<div class="circle"></div>
</div>
<div class="flex-wrap">
<div class="circle"></div>
</div>
<div class="flex-wrap">
<div class="circle"></div>
</div>
</div>
&#13;
预览强>
要说明文本居中,请参阅:
答案 1 :(得分:0)
试试这个。
SELECT W.LineItems_LineItemID
, P.CurrentRate
, P.CurrentEffectiveDate
FROM WorkOrderLineItems W
JOIN PayScaleLoaclJObCodes P
ON P.JobCodeID = W.LineItems_LineItemID
WHERE P.PayScalesLocal_ID = 29
AND W.WorkOrderCurrent_WorkOrderID = 120420
AND P.CurrentEffectiveDate <= '2018-05-27'
ORDER
BY P.CurrentEffectiveDate DESC
答案 2 :(得分:0)
我认为这是关于我如何解决这个问题。希望它有所帮助。
<div class="flex-container">
<div class="flex-item">
<div class="circle"></div>
<h2>T-SHIRTS</h2>
</div>
<div class="flex-item">
<div class="circle"></div>
<h2>T-SHIRTS</h2>
</div>
<div class="flex-item">
<div class="circle"></div>
<h2>T-SHIRTS</h2>
</div>
<div class="flex-item">
<div class="circle"></div>
<h2>T-SHIRTS</h2>
</div>
<div class="flex-item">
<div class="circle"></div>
<h2>T-SHIRTS</h2>
</div>
<div class="flex-item">
<div class="circle"></div>
<h2>T-SHIRTS</h2>
</div>
<div class="flex-item">
<div class="circle"></div>
<h2>T-SHIRTS</h2>
</div>
<div class="flex-item">
<div class="circle"></div>
<h2>T-SHIRTS</h2>
</div>
<div class="flex-item">
<div class="circle"></div>
<h2>T-SHIRTS</h2>
</div>
</div>
html, body {
margin: 0;
padding: 0;
width: 100%;
}
.flex-container {
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
align-content: space-between;
align-items: center;
justify-content: center;
}
.flex-item {
-webkit-flex: 1 1 100px;
flex: 1 1 100px;
padding: 25px 45px;
text-align: center;
}
.circle {
border-radius: 50%;
background: #252525;
width: 150px;
height: 150px;
border: 10px solid #69bf4a;
margin: 20px auto;
}
.circle:hover {
background-color: #69bf4a;
}