いくつかのツールを備えたキャンバスがあり、それは div 内にあります。キャンバスの幅と高さのユーザー入力に基づいて div を自動的に調整するにはどうすればよいですか?
<div id="container">
<canvas id="theCanvas" width="<?php echo $_POST['inputwidth'] ?>" height="<?php echo $_POST['inputheight'] ?>"></canvas>
<div class="tools">
<span class="icon">
<button id="brushTool"></button>
</span>
</div>
</div>
min-height と min-width を設定しようとしましたが、うまくいきませんでした。コンテナーの境界線は、ブラウザーのサイズに従いました。max-height/width を php + 一定のマージンとして入れれば可能ですか? みんなありがとう!=)
#container{
border-right: dotted black 5px;
border-left: dotted black 5px;
border-top: dotted black 5px;
border-bottom: dotted black 5px;
margin: auto;
}
#theCanvas {
border: solid black 5px;
border-radius: 10px;
background: #ffffff;
margin-left: 20%;
margin-top: 20px;
margin-bottom: 20px;
cursor: crosshair;
}