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

CSS를 사용하여 요소의 최소 너비 및 최대 너비 설정

<시간/>

요소의 최소 및 최대 너비를 설정하려면 다음 코드를 실행할 수 있습니다.

예시

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            max-width: 300px;
            min-width: 100px;
            background-color: red;
         }
      </style>
   </head>
   <body>
      <p> Below is a div with maximum and minimum width. Resize the web browser to see the effect.</p>
      <div>This is demo text. This is demo text. This is demo text.
         This is demo text. This is demo text. This is demo text.
         This is demo text. This is demo text. This is demo text.
      </div>
   </body>
</html>

출력

CSS를 사용하여 요소의 최소 너비 및 최대 너비 설정