所以我有一個與7跨度的div - 每個描述日期。最後一個跨度的表現很奇怪,它具有不同的寬度,它以某種方式換行,但它具有可用空間:/。 Here is pic of how it looks最後跨度div的變化它的寬度
.mc-dates-bar
{
margin-left: 60px;
width: 800px;
height: 30px;
}
.mc-single-date
{
font-weight: bold;
font-family: sans-serif;
color: $denim;
font-size: 18px;
margin-left: 15px;
}
<div className="mc-dates-bar">
<span className="mc-single-date">{moment(dates[0]).format("D MMM")}</span>
<span className="mc-single-date">{moment(dates[1]).format("D MMM")}</span>
<span className="mc-single-date">{moment(dates[2]).format("D MMM")}</span>
<span className="mc-single-date">{moment(dates[3]).format("D MMM")}</span>
<span className="mc-single-date">{moment(dates[4]).format("D MMM")}</span>
<span className="mc-single-date">{moment(dates[5]).format("D MMM")}</span>
<span className="mc-single-date">{moment(dates[6]).format("D MMM")}</span>
</div>
嘗試在'%'中使用'width'而不是固定'800px',可能是它可以解決您的問題 –