編輯:https://jsfiddle.net/mLtnofps/CSS對齊第二個文本到第一個文本,這可能是長期或短期
這顯示了「移動設備」大小的問題 - 文本綠色文本,因爲它的左文本
的未對齊目前,這是CSS代碼負責對齊:
.info-block .desc {
border-top: 1px solid #e4e8ea;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
margin-top: .5rem;
padding-top: .5rem;
text-transform: none; }
.info-block .desc .desc__info {
color: #90da85; }
這是HTML模板:(與角4個工作日)
<div class="info-block" *ngIf="chosenGraphPoint">
<div class="current"><span>{{ chosenGraphPoint['date'] }} ·
<span class="amount">${{ chosenGraphPoint['stockValue'] }}</span></span>
<span class="percentage profit"
[ngStyle]="{ 'color': chosenGraphPoint['dailyYield'][0] === '+' ? 'green' : (chosenGraphPoint['dailyYield'][0] === '-' ? 'red' : '#4d5a64')}">
{{ chosenGraphPoint['dailyYield'] }}</span></div>
<div class="desc" *ngFor="let outright of changeReason">
{{ outright['phrase'] }}
<div class="desc__info" [ngStyle]="{ 'color': outright['color'] }">{{ decideImpact(outright['impact']) }}</div>
</div>
<div class="news" *ngFor="let tNews of todayNews">
<div class="news__item" [routerLink]="['/news', tNews.id]" [queryParams]="{date: todayDate, stockId: stock.id}"
style="cursor: pointer">NEWS · {{ tNews.source }} · {{ tNews.title }}</div>
</div>
</div>
相關部分是:
<div class="desc" *ngFor="let outright of changeReason">
{{ outright['phrase'] }}
<div class="desc__info" [ngStyle]="{ 'color': outright['color'] }">{{ decideImpact(outright['impact']) }}</div>
</div>
的輸出是不錯,但不是很一致:
其中大幅下降是罰款(對單詞預期行爲的一部分分開)。然而,中減少不與大幅下降
現在相同的像素,我知道這個代碼是不完美(CSS代碼),但我做了什麼錯?是它的:
{{徹底[ '短語']}}
未正確處理?
在這裏,你將需要要麼顯示:網格或顯示:表/表單元格繪製cols和rows互相咬合。 flex只能按col或逐行繪製列。你有任何普通的HTML而不是HTML + PHP來分享和展示你的問題? –
@ G-Cyr是的,我剛剛編輯了一個正確的jsfiddle提出的問題。 – simon