运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> #myDIV { display: inline-block; margin: 10px 0; border: solid black 1px; background-color: lightblue; min-inline-size: 300px; } </style> </head> <body> <h1>Change min-inline-size property with JavaScript</h1> <p>Click the "Try it" button to change the min-inline-size values of the DIV element. The min-inline-size property value is set to '10px', but the content prevents the size in the inline direction from becoming smaller:</p> <button onclick="myFunction()">Try it</button><br> <div id="myDIV"> <p>This is my DIV element.</p> <p>This text is for filling the box.</p> <p>This text is for filling the box.</p> </div> <script> function myFunction() { document.getElementById("myDIV").style.minInlineSize = "10px"; } </script> </body> </html>