>  기사  >  웹 프론트엔드  >  요소의 콘텐츠가 할당된 공간보다 클 수 있는 경우 어떻게 해야 합니까?

요소의 콘텐츠가 할당된 공간보다 클 수 있는 경우 어떻게 해야 합니까?

WBOY
WBOY앞으로
2023-08-23 22:05:02571검색

요소의 콘텐츠가 할당된 공간보다 클 수 있는 경우 어떻게 해야 합니까?

콘텐츠가 할당된 공간을 초과하는 문제를 해결하려면 CSS Overflow 속성을 사용하세요. 이 문제를 해결하려면 다음 코드를 실행해 보세요. −

Example

<html>
   <head>
   </head>
   <style>
      .scroll{
         display:block;
         border: 2px solid green;
         padding:10px;
         margin-top:10px;
         width:300px;
         height:50px;
         overflow:scroll;
      }
      .auto{
         display:block;
         border: 2px solid green;
         padding:10px;
         margin-top:10px;
         width:300px;
         height:50px;
         overflow:auto;
      }
      </style>
      <body>
         <p>Example of scroll value:</p>
         <div class = "scroll">
            This is Demo Content. This is Demo Content. This is Demo Content.
            This is Demo Content. This is Demo Content. This is Demo Content.
            This is Demo Content. This is Demo Content. This is Demo Content.
            This is Demo Content. This is Demo Content. This is Demo Content.
         </div>
      <br />
   </body>
</html>

위 내용은 요소의 콘텐츠가 할당된 공간보다 클 수 있는 경우 어떻게 해야 합니까?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
이 기사는 tutorialspoint.com에서 복제됩니다. 침해가 있는 경우 admin@php.cn으로 문의하시기 바랍니다. 삭제