Computer >> 컴퓨터 >  >> 프로그램 작성 >> CSS

CSS를 사용하여 컨테이너 끝의 플렉스 항목 정렬

<시간/>

콘텐츠 정당화 사용 값이 flex-end인 속성 끝에 플렉스 항목을 정렬합니다.

예시

flex-end 값을 구현하기 위해 다음 코드를 실행할 수 있습니다 -

<!DOCTYPE html>
<html>
   <head>
      <style>
         .mycontainer {
            display: flex;
            background-color: red;
            justify-content: flex-end;
         }
         .mycontainer > div {
            background-color: #E6B0AA;
            text-align: center;
            line-height: 60px;
            font-size: 30px;
            width: 100px;
            margin: 5px;
         }
      </style>
   </head>
   <body>
      <h1>Score</h1>
      <div class = "mycontainer">
         <div>20</div>
         <div>35</div>
         <div>88</div>
         <div>62</div>
      </div>
   </body>
</html>