logo

Flexbox 사이에 공간을 설정하는 방법은 무엇입니까?

Flexbox 사이의 공간 설정 항목에는 다음과 같은 속성을 사용하는 것이 포함됩니다. 정당화 내용 다음과 같은 값을 가진 사이의 공간 또는 우주 주변 , 그리고 , 주축을 따라 항목 사이의 공간을 균등하게 분배하여 유연한 컨테이너에서 레이아웃 간격과 정렬을 향상시킵니다.

다음과 같은 접근 방식이 있습니다.

내용의 테이블



1. justify-content 속성을 사용합니다.

그만큼 정당화 콘텐츠 속성 ~에 CSS 플렉스박스 주축을 따라 플렉스 항목을 정렬합니다. flex-start, flex-end, center, space-between, space-around, space-evenly와 같은 값을 사용하여 항목 사이에 공간을 분배하고 Flex 컨테이너 내의 정렬과 간격을 제어할 수 있습니다.

통사론:

  • space-between 값은 행 사이에 공백이 있는 플렉스 항목을 표시하는 데 사용됩니다.
justify-content: space-between;>
  • space-around 값은 행 사이, 앞, 뒤에 공백이 있는 플렉스 항목을 표시하는 데 사용됩니다.
justify-content: space-around;>

예: 이 예에서는 CSS Flexbox에서 justify-content를 사용하여 항목 사이에 공간을 분배하는 방법을 보여줍니다. space-around는 항목 주위에 동일한 공간을 만드는 반면, space-around는 항목 사이에 동일한 공간을 배치합니다.

HTML
   Flexboxtitle 사이의 공백><style>.flex2 { 디스플레이: 플렉스;  justify-content: 공백 주변;  배경색: 녹색;  } .flex3 { 디스플레이: 플렉스;  내용 정당화: 공백 사이;  배경색: 녹색;  } .flex-items { 배경색: #f4f4f4;  너비: 100px;  높이: 50px;  여백: 10px;  텍스트 정렬: 중앙;  글꼴 크기: 40px;  } h3 { 텍스트 정렬: 중앙;  } .geeks { 글꼴 크기: 40px;  텍스트 정렬: 중앙;  색상: #009900;  글꼴 두께: 굵게;  } 스타일> 머리> <body> <div>techcodeview.comdiv><h3>Flexboxh3 사이의 공간> <br>  <b>justify-content: 주변 공백 b><div> <div>1div><div>2div><div>3div> div> <br>  <b>내용 정당화: b> 사이의 공백<div> <div>1div><div>2div><div>3div> div> <br>본문> html>></pre> </code> <p dir='ltr'>  <b>  <strong>산출:</strong>  </b>  </p> <p dir='ltr'> <img src='//techcodeview.com/img/css-misc/95/how-set-space-between-flexbox.webp' alt="Flexbox 사이의 공간 설정"></p> <h2 id='2-using-the-gap-property-to-set-space'>  <b>  <strong>2</strong>  </b>  <span>. 사용하여</span>  <b>  <strong>간격 속성</strong>  </b>  <span>공간을 설정하기 위해</span></h2><p dir='ltr'><span>그만큼</span> <span>CSS의 간격 속성</span> <span>Flexbox 또는 Grid 항목 사이에 공간을 설정합니다. 행 간격(row-gap)과 열 간격(column-gap)의 약칭으로, 추가 여백이나 안쪽 여백 없이 일관되게 간격을 관리하기 쉽고 레이아웃 제어 및 가독성이 향상됩니다.</span></p><blockquote style="text-transform: capitalize;font-size: 20px; padding: 10px;"><a href="/java-string-contains">문자열.자바 포함</a>
</blockquote> <p dir='ltr'>  <b>  <strong>통사론:</strong>  </b>  </p> <pre class='hljs'>gap: value;></pre><p dir='ltr'>  <b>  <strong>예:</strong>  </b>  <span>이 예에서는 flexbox 속성과 함께 gap 속성을 사용하여 개별 항목 사이에 간격을 추가합니다.</span></p>HTML<code class='hljs'> <pre class='hljs'> <html> <head> <style>.flex-container { 디스플레이: 플렉스;  간격: 20px;  /* Flex 항목 사이에 원하는 간격을 설정합니다. */ } .flex-item { background-color: lightblue;  패딩: 10px;  } .geeks { 글꼴 크기: 40px;  색상: #009900;  글꼴 두께: 굵게;  } 스타일> 머리> <body> <div>techcodeview.comdiv><h3>간격 속성 사용h3><div> <div>요소 1div><div>요소 2div><div>요소 3div> div> 본문> html>></pre> </code> <p dir='ltr'>  <b>  <strong>산출:</strong>  </b>  </p>  <img src='//techcodeview.com/img/css-misc/95/how-set-space-between-flexbox-2.webp' alt="">  <br>  <br></article><div class="rekl_placeholder"><script type="text/javascript">atOptions = {'key' : 'f2b09f3e7178b263531e10998e9a32fa','format' : 'iframe','height' : 250,'width' : 300,'params' : {}};</script><script type="text/javascript" src="//spiritscaution.com/f2b09f3e7178b263531e10998e9a32fa/invoke.js"></script></div> </article>
                         
                        </div><!--//content-->
                    </div><!--//section-inner-->                 
                </section><!--//section-->
    
            </div><!--//primary-->
            <div class="secondary col-md-4 col-sm-12 col-xs-12">
                  <aside class="info aside section">
                    <div class="section-inner">
                        <h2 class="">범주</h2>
                        <div class="content">
                            <ul class="list-unstyled">
                                <li> <a href="/ms-word-tutorial/">Ms 워드 튜토리얼</a> </li><li> <a href="/permutation/">순열</a> </li><li> <a href="/android-tips-tricks/">안드로이드 팁 트릭</a> </li><li> <a href="/python-dictionary-programs/">Python 사전 프로그램</a> </li><li> <a href="/minecraft-guide/">마인크래프트 가이드</a> </li><li> <a href="/digital-electronics-adders/">디지털 전자제품 - 가산기</a> </li><li> <a href="/python-selenium-exercises/">Python Selenium-연습</a> </li><li> <a href="/dbms-er-model/">Dbms-Er 모델</a> </li><li> <a href="/java-instant-class/">자바 인스턴트 클래스</a> </li><li> <a href="/python-numpy-mathematical-function/">Python Numpy-수학 함수</a> </li>
                                
                            </ul>
                        </div><!--//content-->  
                    </div><!--//section-inner-->                 
                </aside><!--//aside-->
                
                 <aside class="testimonials aside section">
                	 <div class="section-inner">
                        <div class="content">
                            <div class="item">
  								<div class="rekl_placeholder" id="sidebar_placeholder_1"> <script type="text/javascript">atOptions = {'key' : 'f53f1abf3c3a788f849c12a956865db1','format' : 'iframe','height' : 300,'width' : 160,'params' : {}};</script><script type="text/javascript" src="//spiritscaution.com/f53f1abf3c3a788f849c12a956865db1/invoke.js"></script> <br></div>                                                   
                            </div>
                        </div>
                    </div>
                   <div class="section-inner">
                        <h2 class="heading">자바 문자열 조인()</h2>
                        <div class="content">
                            <div class="item">
                                 <blockquote class="quote">                                  
                                    <span> <i class="fa fa-quote-left"></i> 메소드 시그니처와 Java의 연결, 비교, 대문자, 소문자, 트림, 길이, 같음, 분할, 문자열 조인 등의 예가 포함된 Java 문자열 조인() 메소드</span>
                                </blockquote>                
                                                                                             
                            </div><!--//item-->
                            
                            <p> <a class="more-link" href="/java-string-join"> <i class="fa fa-external-link"></i> 자세히보기</a> </p> 
                            
                        </div><!--//content-->
                    </div><!--//section-inner-->
                </aside><!--//section-->
                
               
                            
                 <aside class="languages aside section">
                    <div class="section-inner">
                        <h2 class="heading">재미있는 기사</h2>
                        <div class="content">
                            <ul class="list-unstyled">
                                <li class="item">
                                    <span class="title"> <strong> <a href="/difference-between-network">네트워크와 인터넷의 차이점</a> </strong> </span>
                                    
                                </li><!--//item--><li class="item">
                                    <span class="title"> <strong> <a href="/decimal-binary-converter">십진수를 이진수로 변환기</a> </strong> </span>
                                    
                                </li><!--//item--><li class="item">
                                    <span class="title"> <strong> <a href="/macros-its-types-c">C의 매크로와 그 유형</a> </strong> </span>
                                    
                                </li><!--//item--><li class="item">
                                    <span class="title"> <strong> <a href="/javax-servlet-http-cookie-class-in-java">Javax.servlet.http.Java의 쿠키 클래스</a> </strong> </span>
                                    
                                </li><!--//item--><li class="item">
                                    <span class="title"> <strong> <a href="/vector-insert-function-c-stl">C++ STL의 벡터 insert() 함수</a> </strong> </span>
                                    
                                </li><!--//item-->
                               
                            </ul>
                        </div><!--//content-->
                    </div><!--//section-inner-->
                </aside><!--//section-->
                
              
                 <aside class="list music aside section">
                    <div class="section-inner">
                        <h2 class="heading">인기 게시물</h2>
                        <div class="content">
                            <ul class="list"> <li><a href="/how-does-computer-work">컴퓨터는 어떻게 작동하나요</a>
</li><li><a href="/string-array-java">문자열을 배열로</a>
</li><li><a href="/c-strings">C++에서 문자열 처리</a>
</li><li><a href="/what-is-rom">ROM</a>
</li><li><a href="/diana-blacker-cavendish">다이애나 메리 블랙커</a>
</li><li><a href="/alphabet-numbers">알파벳을 숫자로</a>
</li><li><a href="/c-string-find">문자열 C++에서 찾기</a>
</li> 
                                
                                
                            </ul>
                        </div><!--//content-->
                    </div><!--//section-inner-->
                </aside><!--//section-->
              
            </div><!--//secondary-->    
        </div><!--//row-->
    </div><!--//masonry-->
    
	    <footer class="footer">
        <div class="container text-center">
                <span>
Copyright ©2025 판권 소유 |  <a href="//ro.techcodeview.com/">techcodeview.com</a> | <a href="/disclaimer" rel="nofollow noopener noreferrer" target="_blank">부인 성명</a>  |  <a href="/about-us" rel="nofollow noopener noreferrer" target="_blank">회사 소개</a>  |  <a href="/privacy-policy" rel="nofollow noopener noreferrer" target="_blank">개인 정보 보호 정책</a>  </span>
        </div>
    </footer>
 
         
    <script type="text/javascript" src="https://techcodeview.com/template/assets/plugins/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="https://techcodeview.com/template/assets/plugins/bootstrap/js/bootstrap.min.js"></script>    
    

    <script type="text/javascript" src="https://techcodeview.com/template/assets/js/main.js"></script>     
	
	<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/highlight.min.js"></script>
	<script>
!function(){"use strict";let t=document.createElement("button");t.id="toTopBtn",t.innerHTML="↑";let e=`
        #toTopBtn {
            position: fixed;
            bottom: 25px;
            right: 25px;
            z-index: 9999;
            opacity: 0;
            visibility: hidden;
            background-color: #213141;
            color: white;
            border: none;
            border-radius: 8px;
            width: 50px;
            height: 50px;
            font-size: 24px;
            cursor: pointer;
            transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
        }
        #toTopBtn:hover {
            background-color: #555;
        }
    `,i=document.createElement("style");i.type="text/css",i.innerText=e,document.head.appendChild(i),document.body.appendChild(t),window.addEventListener("scroll",()=>{let e=window.scrollY||document.documentElement.scrollTop;e>300?(t.style.opacity="1",t.style.visibility="visible"):(t.style.opacity="0",t.style.visibility="hidden")}),t.addEventListener("click",()=>{window.scrollTo({top:0,behavior:"smooth"})})}();
</script>
</body>
</html>