중앙에 div를 만든 후 div를 만듭니다. (Make a div, after centered div)


문제 설명

중앙에 div를 만든 후 div를 만듭니다. (Make a div, after centered div)

다른 div를 중심으로 하는 div가 있습니다.

여기에 코드가 있습니다.

<div class="form‑group col‑md‑7 base‑auth‑form" style="text‑align: center;margin‑top: 30px;">
                <h5 style="margin‑top: 30px;font‑size: 20px;">{{'ChooseSubscription' | localize}}</h5>
                <div style="height:80%">
                    <mat‑tab‑group mat‑align‑tabs="center">
                        <mat‑tab label="MONTLY" style="color: white !important">
                            <div class="row" style="margin‑left: 20px; margin‑right: 20px;">
                                <div *ngFor="let item of subscriptions" class="col‑4">
                                    <div class="card" style="border‑radius: 7px;height: 425px;">
                                        <h4 class="header‑subsc‑card"><b>{{item.name}}</b></h4>
                                        <h5 class="header‑subsc‑card">{{item.description}}</h5>
                                        <h4 class="header‑subsc‑card" style="margin‑top: 30px;"><b
                                                style="font‑size: 24px;">£
                                                {{item.priceMonthly}}</b> /
                                            {{'month' | localize}}</h4>
                                        <button
                                            class="btn‑rent‑default subscribe‑button ">{{'Subscribe' | localize}}</button>

                                        <mat‑list>
                                            <mat‑list‑item *ngFor="let option of item.pm101SubscriptionOptions"
                                                role="listitem">
                                                <mat‑icon mat‑list‑icon class="green‑icon">check</mat‑icon>
                                                {{option.value}} {{option.name}}
                                            </mat‑list‑item>
                                        </mat‑list>
                                    </div>
                                </div>
                            </div>
                        </mat‑tab>
                        <mat‑tab label="YEARLY" style="color: white !important">
                            <div class="row" style="margin‑left: 20px; margin‑right: 20px;">
                                <div *ngFor="let item of subscriptions" class="col‑4">
                                    <div class="card" style="border‑radius: 7px;height: 425px;">
                                        <h4 class="header‑subsc‑card"><b>{{item.name}}</b></h4>
                                        <h5 class="header‑subsc‑card">{{item.description}}</h5>
                                        <h4 class="header‑subsc‑card" style="margin‑top: 30px;"><b
                                                style="font‑size: 24px;">£
                                                {{item.priceYearly}}</b> /
                                            {{'month' | localize}}</h4>
                                        <button
                                            class="btn‑rent‑default subscribe‑button ">{{'Subscribe' | localize}}</button>

                                        <mat‑list>
                                            <mat‑list‑item *ngFor="let option of item.pm101SubscriptionOptions"
                                                role="listitem">
                                                <mat‑icon mat‑list‑icon class="green‑icon">check</mat‑icon>
                                                {{option.value}} {{option.name}}
                                            </mat‑list‑item>
                                        </mat‑list>
                                    </div>
                                </div>
                            </div>
                        </mat‑tab>
                    </mat‑tab‑group>
                </div>
                <div style="width:100%;height:20% ;margin‑top:30px;">
                    <button class="btn‑rent‑default‑transparent back‑button">{{'Back' | localize}}</button>
                </div>
            </div>

여기에 이 div의 스타일이 있습니다.

.base‑auth‑form {
box‑shadow: 0 0 22px 0 rgba(25, 35, 62, 0.19), 0 2px 16px 0 rgba(25, 35, 62, 0.13) !important;
background: linear‑gradient(161deg, #364972, #19233e 90%), linear‑gradient(to bottom, #ffffff, #ffffff);
position: absolute !important;
top: 50% !important;
left: 50% !important;
transform: translate(‑50%, ‑50%) !important;
border‑radius: 5px !important;
color: white !important;
min‑width: 200px;
min‑height: 200px;

}

이 div 뒤에 새 div를 만들려고 하지만 항상 맨 위에 있습니다.

다음과 같습니다.

이를 어떻게 고칠 수 있나요?

여기에 이미지 설명 입력


참조 솔루션

방법 1:

You have assigned position: absolute for your first div element which resulted in the following div element to stay on top of it.

Solution: wrap both the div elements in a new div element and assign position: absolute to the new element. Try this.

<div class="wrapdiv">
    <div class="form‑group col‑md‑7 base‑auth‑form" style="text‑align: center;margin‑top: 30px;">
        your content here
    </div>
    <div>
        this is the new element you want to stay below
    </div>
</div>

CSS

.wrapdiv {
  position: absolute !important;
}
.base‑auth‑form {
  box‑shadow: 0 0 22px 0 rgba(25, 35, 62, 0.19), 0 2px 16px 0 rgba(25, 35, 62, 0.13) !important;
  background: linear‑gradient(161deg, #364972, #19233e 90%), linear‑gradient(to bottom, #ffffff, #ffffff);
  top: 50% !important;
  left: 50% !important;
  transform: translate(‑50%, ‑50%) !important;
  border‑radius: 5px !important;
  color: white !important;
  min‑width: 200px;
  min‑height: 200px;
}

(by Eugene SukhAryan Twanju)

참조 문서

  1. Make a div, after centered div (CC BY‑SA 2.5/3.0/4.0)

#SASS #css #html






관련 질문

나침반 SCSS 글꼴 URL 구성 문제 (Compass SCSS font-url configuration issue)

SASS: normalize.css가 작동하지만 컴파일된 CSS 파일에 표시되지 않습니까? (SASS: normalize.css works, but does not show up in compiled CSS file?)

CSS zurb 기초 및 dhtmlx (CSS zurb foundation and dhtmlx)

_settings.scss의 변수는 주석 처리되지 않은 상태로 컴파일됩니다. (Variables in _settings.scss are compiled as uncommented)

Grunt 및 Compass와 함께 node-normalize-scss 사용 (Using node-normalize-scss with Grunt and Compass)

부트스트랩이 있는 루프를 사용하여 여러 이벤트 추가 (Using a loop with bootstrap to add multiple events)

특정 파일에 대한 앵귤러 로더 재정의 (Override angular loaders for specific files)

상자 그림자가 있는 여러 겹치는 이미지에 대한 CSS (CSS for multiple overlapping images with box shadow)

중앙에 div를 만든 후 div를 만듭니다. (Make a div, after centered div)

소품과 값 사이에 공백을 적용하기 위한 Sass linting 규칙이 VS Code에서 잘못 작동합니까? (Is the Sass linting rule for enforcing a space between the prop and value working incorrectly with VS Code?)

Next.js를 사용하는 scss의 클래스 이름 규칙 (Class names convention for scss using Next.js)

새 프로젝트를 만드는 동안 Angular CLI에서 sass를 선택했습니다. 이제 sc로 변경하고 싶습니다. 어떻게 할 수 있습니까? (I chose sass in angular CLI while i was creating the new project. i want to change it to scss now. how can i do that?)







코멘트