minWidth 사용 최소 너비를 설정하려면 JavaScript의 속성을 사용하십시오. JavaScript로 요소의 최소 너비를 설정하기 위해 다음 코드를 실행할 수 있습니다 -
예시
<!DOCTYPE html> <html> <head> <style> #box { width: 50%; background-color: gray; } </style> </head> <body> <p>Click below to set Minimum width.</p> <button type="button" onclick="display()">Min Width</button> <div id="box"> <p>This is a div. This is a div. This is a div. This is a div. This is a div.</p> <p>This is a div. This is a div. This is a div. This is a div. This is a div.</p> <p>This is a div. This is a div. This is a div. This is a div. This is a div.</p> <p>This is a div. This is a div. This is a div. This is a div. This is a div.</p> <p>This is a div. This is a div. This is a div. This is a div. This is a div.</p> </div> <br> <script> function display() { document.getElementById("box").style.minWidth = "500px"; } </script> </body> </html>