向左对齐“角材料”选项卡主体内容

时间:2019-07-22 04:04:08

标签: css angular typescript angular-material

我正在使用角材料制作角7。目前,我遇到问题,如下图所示。

enter image description here

有没有一种方法可以将内容选项卡向左推。例如像波纹管。当我尝试向左推动时,它隐藏在“方法”标题下。

enter image description here 这是我的代码

HTML

<div class="method">
  <div>
    <h3 class="method-title">Mathod</h3>
    <hr class="line-method">
  </div>
  <mat-tab-group animationDuration="6ms">
    <mat-tab label="First">
      <ng-template mat-tab-label>
        <button type="button" class="btn  btn-white active">Personal Info</button>
      </ng-template>
      <div class="container tab-padd">
        <div class="row">
          <div class="col-md-6">
            <div class="form-group">
              <div class="sub-form">
                <label for="firstName">First Name</label>
                <input type="text" class="form-control shot" name="firstName"
                                                        required />
              </div>
              <div class="sub-form">
                <label class="right-inline" for="lastName">Last Name</label>
                <input value="" class="form-control shot" name="lastName"                                                        
                                                        required />
              </div>
            </div>
          </div>
        </div>
      </div>
    </mat-tab>
    <mat-tab label="Second">
      <ng-template mat-tab-label>
        <button type="button" class="btn btn-white active">Another Info</button>
      </ng-template>
      <div class="container tab-padd">
        <div class="row">
          <div class="col-md-6"> </div>
        </div>
      </div>
    </mat-tab>
  </mat-tab-group>

CSS

.method-title{
    padding: 12px 84px;
    width: max-content;
}

.line-title{
    margin-top: 4rem !important;
    /* margin-bottom: 3rem !important; */
    width: 22%;
    margin-left:-14px; 
    text-align:left;
}

.justify-content-left{
    padding-left: 85px;
}

.radio-group{
  display: flex;
  flex-direction: row;
  margin: 15px 0;
}

.justify-content-between{
    justify-content: space-between;
    display: flex;
}

.border{
    width: calc(100% - 46rem);
    text-align: left;
    margin-left: 4px;
}

#container {
    display: flex;
    justify-content: space-between; /* Can be changed in the live sample */
    width: 40%;
    padding-left: 1rem;
  }

  .space-bottom-2{
    padding-bottom: 2rem;
  }

  .custome-row{
    display: contents !important;
    line-height: 6px;
  }

  .method{
      display: flex;

  }

  .line-method{
    margin-top: -1.8rem !important;
    width: 78%;
    margin-left: -12px;
    text-align: left;
  }

  .mat-tab-label::ng-deep {
    width: 900rem !important;
}

  /* form specific formatting */
  .tab-padd{
    padding-top: 24px !important;
    column-span: all;
}
.form-group {
    display: flex;
    flex-direction: row;
  }

  .sub-form{
    flex-direction: column;
  }

  .form-group label {
    flex: none;
    display: block;
    width: 125px;
    font-weight: bold;
    font-size: 1em;
    white-space: nowrap;
  }
  .form-group label.left-inline {
    text-align: left;  
    padding-right: 8px;
    padding-left: 10px;
    width: auto;
  }

  .form-group .shot{
    width: 20rem
  }

  .form-group .long{
    width: 40rem
  }

有关演示,您可以转到Stackblitz

希望大家都能提供帮助。

预先感谢

1 个答案:

答案 0 :(得分:1)

您可以为.mat-tab-body-wrapper设置负边距

.mat-tab-body-wrapper{margin-left: -190px;}