代码之家  ›  专栏  ›  技术社区  ›  Teddy Kossoko

仅在大屏幕上添加边距

  •  0
  • Teddy Kossoko  · 技术社区  · 6 年前

    我正在开发一个角度为9的应用程序。 在我看来,我添加magin是为了减小表单的大小

    <div class="row">
      <div class="col-12 mb-4" *ngIf="!displayListCompanies; else companiesList">
        <div class="card" style="min-height: 579px; margin-right: 200px; margin-left: 200px">
          <div class="card-body justify-content-between align-items-center">
            <div class=" company-welcome-logo">
    
            </div>
            <p class=" text-justify text-center font-weight-bold font-size-xlarge"><b>{{'company.welcome-abord' | translate}} {{ displayName }} !</b></p>
            <p class=" text-justify text-center">{{'company.welcome-text1' | translate}} <br/> {{'company.welcome-text2' | translate}} </p>
    
            <button class="btn btn-primary btn-lg btn-shadow align-items-center align-content" (click)="createCompany()">
              {{ "company.create" | translate }}
            </button>
    
          </div>
        </div>
    
      </div>
    
      <ng-template #companiesList>
        Another magic element!
      </ng-template>
    </div>
    <simple-notifications></simple-notifications>
    

    enter image description here

    在中屏幕上,我想保留边距,但在小设备上删除它。 enter image description here

    我怎么能这样做?提前谢谢。

    1 回复  |  直到 6 年前
        1
  •  1
  •   wabyroadefgcu    6 年前

    使用CSS媒体查询。只将多余的边距放在最小宽度:XXXX部分。

    就像这样。。。

    <style>
    
    @media only screen and (min-width: 1000px) {
      /* For large screens: */
      .card {margin-right: 200px; margin-left: 200px}
    }
    
    </style>