无法在页面上使某些元素响应?

时间:2019-06-14 09:53:43

标签: html css

我有一个主页,在响应之前,我添加了2个按钮,1个文本和3张图片,并将它们用作背景,如果我试图使窗口变小,则页面消失甚至导致响应消失移动版本。因为我是flex-layout的初学者,所以我尝试了一些尝试,但是我不知道这个主意,希望有人能帮助我解决这个问题。 问题在于我必须在下面显示的图像中用黄色强调一下,它们没有响应,并且我在其样式上应用了许多想法。但仍然可以解决。我希望他们能做出响应,我的意思是,如果我将窗口缩小,它们将保持相同的位置;如果移动窗口变小,则窗口将变小,但是必须保持在它们的位置,而到目前为止,它们不是。

:host {
  // background: #d0d0d094;
  background: linear-gradient(to right, #5674f7 0%, rgba(255, 255, 255, 0) 100%), #35adda;
  height: 100%;
  width: 100%;
  display: block;
  // background-image: url("assets/images/background.svg");
}

.header {
  min-height: 80vh;
  align-self: flex-start;
}

.header__container {
  padding-top: 12rem;
}

#home {
  // background: linear-gradient(59.98deg, #5674f7 0%, rgba(255, 255, 255, 0) 100%), #35adda;
  background: linear-gradient(to right, #5674f7 0%, rgba(255, 255, 255, 0) 100%), #35adda;
  color: #535252;
  // background: linear-gradient(59.98deg, #5674f7 0%, rgba(255, 255, 255, 0) 100%), #35adda;
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
}

.arrow-down {
  display: flex;
  width: 0.9rem;
  height: 1.5rem;
  margin-left: -0.25rem;
  margin-top: -0.5rem;
}

.img {
  width: 9rem;
  height: 8.3rem;
}

.fontWeightTitle {
  font-weight: 500;
}

.home__middle {
  width: 100%;

  &-container {
    width: 100%;
    max-width: 80rem;
  }

  &-box-container-heading {
    color: #222;
    font-weight: bold;
  }

  &-box-container-subheading {
    color: #222;
  }

  &-arch-section {
    display: block;
    position: relative;
    bottom: 5rem;
    width: 100%;
    height: 26rem;

    img {
      width: 100%;
      position: absolute;
      bottom: 0;
      right: 0;
      z-index: -99;
    }

    &--sign__button {
      position: absolute;
      bottom: -0.5rem;
      width: 13rem;
      height: 5rem;
      text-align: center;
      border-radius: 3rem;
      background: #fd7d7d !important;
      color: #fff !important;
      padding: 0.8rem;
      border: none;
      font-weight: bold;
    }

    .czechbusinesscloud {
      position: absolute;
      bottom: 7rem;
      display: inline-block;
      font-family: 'Quicksand', sans-serif;
      font-style: normal;
      font-weight: normal;
      font-size: 2.4rem;
      line-height: 3rem;
      color: #fff;

      .businesscloud {
        font-weight: bold;
        color: #fff;
      }
    }
  }

  &-popular-button {
    max-width: 20rem;

    button {
      width: 13rem;
      height: 5rem;
      text-align: center;
      font-family: 'Quicksand', sans-serif;
      background: #fff;
      color: #222;
      padding: 0.8rem;
      border: 1px solid #222;
      box-sizing: border-box;
      cursor: pointer;
      font-style: normal;
      font-weight: bold;
      border-radius: 3rem;
    }
  }

  & .home__middle-container {
    & .home__middle-box {
      text-align: center;
      width: 32rem;
      height: 34rem;
      background: #fff;
      box-shadow: 0 0 1.5rem rgba(34, 34, 34, 0.35);
      padding: 1.6rem;
      border-radius: 8px;

      &-button {
        width: 90%;
        height: 30px;
        font-weight: bold;
        border-radius: 3rem;
        color: #0486fe;
        background: #fff;
        padding: 0.5rem;
        border: none;
        text-align: center;
        font-size: 1.6rem;
        line-height: 2rem;
        font-style: normal;
      }
    }

    & .home__middle-box-icon-wrapper {
      position: relative;
      width: 6rem;
      height: 6rem;
      background: #0486fe;
      border-radius: 3rem;

      & .home__middle-box-icon--glass {
        position: absolute;
        top: 1.4rem;
        left: 1.2rem;
      }

      & .home__middle-box-icon--question {
        position: absolute;
        top: 1.4rem;
        left: 1.8rem;
      }
    }
  }

  .home__button-container {
    width: 20rem;
  }
}

#home--step-1 {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
  padding-bottom: 8rem;

  & .info-box__description {
    color: #fff;
    padding-bottom: 2rem;
    cursor: pointer;
  }

  .info-box {
    width: 45rem;
    border: none;
    padding: 1rem;
    margin: 1rem;

    & .info-box__header {
      width: 100%;
      color: #fff;

      & .info-box__heading {
        padding-bottom: 2rem;
      }
    }

    & .info-box__button--description {
      color: #686767;
      text-align: center;
      background: #fff;
      border-radius: 3rem;
      border: none;
      padding: 1rem 1.3rem;
      margin-top: 2rem;
      cursor: pointer;
    }
  }
}

#home--step-2 {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;

  & .info-box__description {
    color: #fff;
    padding-bottom: 2rem;
  }

  .info-box {
    width: 45rem;
    border: none;
    padding: 1rem;
    margin: 1rem;

    & .info-box__header {
      width: 100%;
      color: #fff;

      & .info-box__heading {
        padding-bottom: 2rem;
      }
    }

    & .info-box__button--description {
      color: #686767;
      text-align: center;
      width: 25rem;
      background: #fff;
      border-radius: 3rem;
      border: none;
      padding: 1rem 1.3rem;
      margin-top: 2rem;
    }
  }
}

#categories {
  // background: rgba(228, 225, 225, 0.424);
  // background: linear-gradient(59.98deg, #5674f7 0%, rgba(255, 255, 255, 0) 100%), #35adda;
  padding: 5rem 10rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-top: 18rem;
  font-family: 'Quicksand', sans-serif;
}

.categories-heading h2 {
  color: #535252;
}

.info-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 20rem;
  padding: 2rem;
  margin: 1rem;
  border: 1rem solid rgba(205, 184, 223, 0.739);
}

.info-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 0;
}

.heading {
  color: #0486fe;
  height: 6rem;
  margin-top: 1rem;
}

.heading-top {
  color: #fff;
  margin-bottom: 4rem;
}

.icon {
  //color: rgba(0, 214, 170, 0.85);
  color: #c7c5c5ab;
  margin-top: 1rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(5, 13.6rem);
  grid-template-rows: repeat(3, 13.6rem);
  grid-gap: 3.5rem;

  .gallery-caption {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    text-align: center;
  }

  .gallery-box {
    background: white;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 1.6rem;
    max-width: 16rem;
    padding: 1rem;
  }
}

button {
  a {
    text-decoration: none;
    color: inherit;
  }
}

:host-context {
  width: 100%;
  flex-direction: column;
}

.step1 {
  background: #fff;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  padding: 1rem;
  font-family: Quicksand, sans-serif;

  .step1-text {
    text-align: left;
    align-items: center;
    padding: 2%;
    float: left;
    padding-right: 3%;
    font-size: 14px;
    line-height: normal;

    h2 {
      color: #2e2e2e;
      padding-bottom: 2rem;
      font-size: 1.8rem;
      font-weight: bold;
      line-height: 2.2rem;
    }

    p {
      padding-top: 1rem;
      color: #2e2e2e;
      font-family: 'Quicksand', sans-serif;
      font-style: normal;
      font-weight: normal;
      font-size: 1.4rem;
      line-height: 1.7rem;
    }
  }

  .step1-graph {
    align-items: center;
    float: right;
    padding: 2%;

    // #step3 {
    //   //padding-top: 3%;
    //  // padding-bottom: 3%;
    // }

    .container {
      min-height: 100%;
      width: 100%;
      padding-top: 12%;
      padding-bottom: 12%;
    }
  }
}

.graphic-div {
  margin-top: -14rem;
}

.graphic {
  margin-top: -48rem;
  margin-left: 145rem;
  width: 27.7%;
}

.container-right {
  min-height: 100%;
  width: 10%;
  padding-top: 12%;
  padding-bottom: 12%;
  background: url(/assets/images/homepage/glass-right.svg);
  background-repeat: no-repeat;
  position: absolute;
  right: 0;
  float: right;
  background-position: right;
  top: -8.1rem;
}

.step2 {
  background: #fff;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  padding: 1rem;
  text-align: center;
  border: 1px solid #e5e5e5;

  .step2-text {
    text-align: left;
    align-items: center;
    padding: 2%;

    h2 {
      color: #2e2e2e;
      padding-bottom: 2rem;
      font-size: 1.8rem;
      font-weight: bold;
      line-height: 2.2rem;
    }

    p {
      padding-top: 1rem;
      color: #2e2e2e;
      font-family: 'Quicksand', sans-serif;
      font-style: normal;
      font-weight: normal;
      font-size: 1.4rem;
      line-height: 1.7rem;
    }
  }

  .step2-graph {
    align-items: center;
    padding: 2%;
    width: 100%;

    #step3 {
      padding-top: 3%;
      padding-bottom: 3%;
    }

    .container {
      min-height: 100%;
      width: 100%;
      padding-top: 12%;
      padding-bottom: 12%;
    }
  }
}

.container-left {
  min-height: 100%;
  width: 10%;
  padding-top: 12%;
  padding-bottom: 12%;
  background: url(/assets/images/homepage/glass-left.svg);
  position: absolute;
  left: 0;
  background-repeat: no-repeat;
  float: left;
  background-position: left;
  top: -5rem;
}

.catalog__button {
  width: 13rem;
  text-align: center;
  font-family: 'Quicksand', sans-serif;
  border-radius: 2.5rem;
  color: #0486fe;
  background: #fff;
  padding: 0.8rem;
  margin: 1.6rem 0;
  border: 1px solid #0486fe;
  box-sizing: border-box;
  cursor: pointer;
  font-style: normal;
  font-weight: bold;

  a {
    color: #fff;
  }
}
<div class="typography" id="home">
    <app-nav>
      <div class="header">
  
        <div class="header__container">
          <app-header
            (search)="handleSearch($event)"
            (searchApps)="searchApps($event)"
            [filteredApps]="filteredApps"
            [isLoading]="isLoading">
          </app-header>
        </div>
  
        <section class="home__middle"
          fxLayout="column"
          fxLayoutGap="2rem"
          fxLayoutGap.xs="1rem"
          fxLayoutAlign="center center" fxFlexFill>
          <div class="home__middle-container"
            fxLayout="row"
            fxLayout.lt-sm="column"
            fxLayoutGap.xs="1rem"
            fxLayoutGap="6rem"
            fxLayoutAlign="center center"
            fxFlexFill>
  
            <div class="home__middle-box"
              fxLayout="column"
              fxLayoutAlign="center center"
              fxLayoutGap="1rem">
  
              <div>
                <img class="img"
                  src="assets/images/homepage/089-telescope.png">
              </div>
              <div>
                <h2
                  class="home__middle-box-container-heading mat-subheading-2">
                  {{ 'home.looking-for-a-specific-software' | translate }}
                </h2>
              </div>
              <p
                class="home__middle-box-container-subheading mat-subheading-1 ">
                {{ 'home.browse-the-categories' | translate }}<br>
                {{ 'home.catalogue' | translate }}<br>
                {{ 'home.help' | translate }}<br>
                {{ 'home.challenges' | translate }}
              </p>
              <button
                class="home__middle-box-button"
                routerLink="/browse"
                style="cursor: pointer;">
                {{ 'home.browse-catagories' | translate }}
              </button>
            </div>
  
            <div
              class="home__middle-box"
              fxLayout="column"
              fxLayoutAlign="center center"
              fxLayoutGap="2rem">
              <div>
                <img class="img"
                  src="assets/images/homepage/023-idea.png">
              </div>
              <h2
                class="home__middle-box-container-heading mat-subheading-2">
                {{ 'home.are-you-not-sure' | translate }}
              </h2>
              <p
                class="home__middle-box-container-subheading mat-subheading-1">
                {{ 'home.do-you-have-specific-challenge' | translate }}<br>
                {{ 'home.advice' | translate }}<br>
                {{ 'home.suits' | translate }}
              </p>
              <button
                class="home__middle-box-button"
                (click)="getRecommendationsClick()"
                id="home__middle-box-button"
                style="cursor: pointer;">
                {{ 'home.get-recommendations' | translate }}
              </button>
            </div>
          </div>
          <div
            class="home__middle-popular-button">
            <button
              (click)="scroll(target)">
              Popular categories
            </button>
          </div>
          <div class="arrow-down">
            <img src="assets/images/Vector.png"
              class="vector">
          </div>
          <div class="home__middle-arch-section"
            fxLayout="column"
            fxLayoutAlign="center center"
            fxLayoutGap="2rem">
            <div
              class="czechbusinesscloud">czech<span
                class="businesscloud">business</span>cloud
              and app store for your business</div>
            <button
              class="home__middle-arch-section--sign__button"
              (click)="scroll(target)">
              Sign Up
            </button>
            <img src="assets/images/background.svg">
          </div>
          <div class="graphic-div">
            <img src="/assets/images/Graphic.svg" class="graphic">
        </div>
        </section>
      </div>
      <!-- <div>
          <img src="/assets/images/Vector1.png" class="vectorsvg">
      </div> -->
  
      <section class="steps-container">
        <div class="step1" fxLayout="row wrap"
          fxLayout.lt-md="column-reverse"
          fxLayoutGap="32px"
          fxLayoutAlign="space-evenly center">
          <div class="step1-text"
            fxFlex="0 1 calc(33% - 32px)"
            fxFlex.lt-md="0 1 calc(50% - 32px)"
            fxFlex.lt-sm="100%">
            <span
              class="mat-subheading-2 fontWeightTitle">
              {{ 'home.step1-complete-questionnaire' | translate }}
            </span>
            <p>
              {{ 'home.tell-us-something-about-your-business' | translate }}
            </p>
            <p>
              {{ 'home.looking-for-package' | translate }}
            </p>
            <p>
              {{ 'home.are-you-overwhelmed' | translate }}
            </p>
            <div class="button">
              <button class="catalog__button"
                (click)="goToQuestionnaireClick()">
                {{ 'home.go-to-questionnaire' | translate }}
              </button>
            </div>
          </div>
          <div class="step1-graph"
            fxFlex="0 1 calc(35% - 2px)"
            fxFlex.lt-md="0 1 calc(50% - 32px)"
            fxFlex.lt-sm="100%">
            <div class="container" fxLayout="row"
              fxLayout="row wrap" fxLayoutGap="1%"
              fxLayoutAlign="space-evenly center">
              <img
                src="assets/images/homepage/026-curriculum-1.png"
                width="44.64%" height="44.64%">
            </div>
            <div class="container-right" fxLayout="row"
            fxLayout="row wrap" fxLayoutGap="1%"
            fxLayoutAlign="space-evenly center" style="margin-left: -20rem; margin-top: -37rem;">
          </div>
          </div>
        </div>
  
        <div class="step2" fxLayout="row wrap"
          fxLayout.lt-md="column" fxLayoutGap="32px"
          fxLayoutAlign="space-evenly center">
          <div class="container-left" fxLayout="row"
          fxLayout="row wrap" fxLayoutGap="1%"
          fxLayoutAlign="space-evenly center" style="margin-left: -53rem; margin-top: -37rem;">
        </div>
          <div class="step2-graph"
            fxFlex="0 1 calc(35% - 2px)"
            fxFlex.lt-md="0 1 calc(50% - 32px)"
            fxFlex.lt-sm="100%">
            <div class="container" fxLayout="row"
              fxLayout="row wrap" fxLayoutGap="1%"
              fxLayoutAlign="space-evenly center">
              <img
                src="assets/images/homepage/074-employee-3.png"
                width="44.64%" height="44.64%">
            </div>
          </div>
          <div class="step2-text"
            fxFlex="0 1 calc(32% - 32px)"
            fxFlex.lt-md="0 1 calc(50% - 32px)"
            fxFlex.lt-sm="100%">
            <span
              class="mat-subheading-2 fontWeightTitle">
              {{ 'home.step2-check-result' | translate }}
            </span>
            <p>
              {{ 'home.check-the-recommended-apps' | translate }}
            </p>
            <p>
              {{ 'home.browse-the-apps-for-your-need' | translate }}
            </p>
            <div class="button">
              <button class="catalog__button"
                (click)="getRecommendationsClick()">
                {{ 'home.get-recommended-apps' | translate }}
              </button>
            </div>
          </div>
        </div>
      </section>
      <section class="steps-container">
        <div class="step1" fxLayout="row wrap"
          fxLayout.lt-md="column-reverse"
          fxLayoutGap="32px"
          fxLayoutAlign="space-evenly center">
          <div class="step1-text"
            fxFlex="0 1 calc(33% - 32px)"
            fxFlex.lt-md="0 1 calc(50% - 32px)"
            fxFlex.lt-sm="100%">
            <span
              class="mat-subheading-2 fontWeightTitle">
              {{ 'home.step3-read-reviews' | translate }}
            </span>
            <p>
              {{ 'home.read-what-other-think' | translate }}
            </p>
            <p>
              {{ 'home.simple-star-ranking' | translate }}
            </p>
            <div class="button">
              <button class="catalog__button"
                (click)="goToCatalogueClick()">
                {{ 'home.see-reviews' | translate }}
              </button>
            </div>
          </div>
          <div class="step1-graph"
            fxFlex="0 1 calc(35% - 2px)"
            fxFlex.lt-md="0 1 calc(50% - 32px)"
            fxFlex.lt-sm="100%">
            <div class="container" fxLayout="row"
              fxLayout="row wrap" fxLayoutGap="1%"
              fxLayoutAlign="space-evenly center">
              <img
                src="assets/images/homepage/024-businessman-20.png"
                width="44.64%" height="44.64%"
                id="step3">
            </div>
          </div>
        </div>
  
        <div class="step2" fxLayout="row wrap"
          fxLayout.lt-md="column" fxLayoutGap="32px"
          fxLayoutAlign="space-evenly center">
          <div class="step2-graph"
            fxFlex="0 1 calc(35% - 2px)"
            fxFlex.lt-md="0 1 calc(50% - 32px)"
            fxFlex.lt-sm="100%">
            <div class="container" fxLayout="row"
              fxLayout="row wrap" fxLayoutGap="1%"
              fxLayoutAlign="space-evenly center">
              <img
                src="assets/images/homepage/040-launch.png"
                width="44.64%" height="44.64%">
            </div>
          </div>
          <div class="step2-text"
            fxFlex="0 1 calc(35% - 32px)"
            fxFlex.lt-md="0 1 calc(50% - 32px)"
            fxFlex.lt-sm="100%">
            <span
              class="mat-subheading-2 fontWeightTitle">
              {{ 'home.step4-start-using-the-app' | translate }}
            </span>
            <p>
              {{ 'home.now-start-use-app' | translate }}
            </p>
            <p>
              {{ 'home.no-need-to-download-apps' | translate }}
            </p>
            <div class="button">
              <button class="catalog__button"
                (click)="goToCatalogueClick()">
                {{ 'home.get-my-apps' | translate }}
              </button>
            </div>
          </div>
        </div>
      </section>
      <div #target>
        <app-listing>
        </app-listing>
      </div>
      <app-footer></app-footer>
    </app-nav>
  </div>

问题:  我在显示屏上的照片只有五个错误。 first second

2 个答案:

答案 0 :(得分:2)

我建议您制作自己的CSS,并且不要依赖任何CSS库,因为您将很容易理解自己的代码而非库。说到图像,请在HTML5 Canvas上付出一些努力。您将能够创建此类图案,而无需图像。

答案 1 :(得分:1)

您可以使用引导网格布局,并应尝试将div保持在列中。您可以找到教程here。要并排对齐三个div:

<div class="row">
  <div class="col-md-3">
    DIV CONTENT
  </div>
  <div class="col-md-3">
    DIV CONTENT
  </div>
  <div class="col-md-3">
    DIV CONTENT
  </div>
</div>