简体   繁体   中英

Angular2 Material Toolbar - reduce multi-line text spacing

I have a toolbar in angular2 material. Left side has app title, and on the right hand side I want to have some lines of text.

My problem is that the spacing between the lines is huge - how do I reduce this spacing between the lines? See the https://plnkr.co/edit/btull6fX1rB4232L4DrW?p=preview / screenshot below.

在此处输入图片说明

My html:

<md-toolbar color="primary">
  <p>AppTitle</p>

  <!-- fill remaining space -->
  <span style="flex: 1 1 auto;"></span>

  <!-- QUESTION: -->
  <!-- HOW CAN I REDUCE SPACE BETWEEN LINES -->
  <p style="font-size: x-small;">
    <span >Line1</span>
    <br/>
    <span >Line2</span>
    <br/>
    <span>Line3</span>
  </p>

</md-toolbar>

I have added some css to line-break the spans, so that we can get rid of the <br/> . Then added a css class to all spans to set the max-height .

在此处输入图片说明

html:

<md-toolbar color="primary">
  <p>AppTitle</p>

  <span style="flex: 1 1 auto;"></span>

  <div class="far-end">
    <span class="space-reducer">Line1</span>
    <span class="space-reducer">Line2</span>
    <span class="space-reducer">Line3</span>
  </div>
</md-toolbar> 

css:

.far-end{
  font-size: x-small;
  display: inline-grid;
  margin-bottom: auto;
}

.space-reducer{
  max-height: 14px;
}

Edited plunker

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM