問題描述
角材料中心佈局 (Angular Material center layout)
我用 Angular Material 弄濕了我的腳。
第二個
標籤,即“主人的名字”應該出現在中間。而 ngmasters 的位置很好。
這就是我試圖實現此功能無濟於事的方式:
<md‑toolbar>
<div class="md‑toolbar‑tools">
<p><strong>ngMasters</strong></p>
<div layout="row" layout‑align="center center">
<p>Name of the Master</p>
</div>
</div>
</md‑toolbar>
任何幫助或方向都將不勝感激。謝謝。
參考解法
方法 1:
You'll need to apply the flex
attribute to the <div>
so it takes up available space within the <md‑toolbar>
:
<md‑toolbar>
<div class="md‑toolbar‑tools">
<p><strong>ngMasters</strong></p>
<div flex="" layout="row" layout‑align="center center">
<p>Name of the Master</p>
</div>
</div>
</md‑toolbar>