jQueryオブジェクト03
要素の幅/高さを変更する - width/height
ソースコード【 HTML 】
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <title>要素の幅/高さを変更する - width/height</title> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <style> body { background-color: #F93; } #div1 { width: 300px; height: 200px; background-color: #F9F; } #div2 { width: 300px; height: 200px; background-color: #6CF; } </style> </head> <body> <div id="div1">width</div> <div id="div2">height</div> <script> $(function() { $('#div1').width(400); $('#div2').height(400); }) </script> </body> </html>
ブラウザで表示【 Chrome 】