Download jQuery/07_CSS操作4_outerWidthouterHeight.html from zxy0307/Python_07_front_end: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/zxy0307/Python_07_front_end/resolve/main/jQuery/07_CSS%E6%93%8D%E4%BD%9C4_outerWidthouterHeight.html
- Command line
-
hf download hf://zxy0307/Python_07_front_end/jQuery/07_CSS操作4_outerWidthouterHeight.html
-
curl -L -o 07_CSS操作4_outerWidthouterHeight.html https://huggingface.co/zxy0307/Python_07_front_end/resolve/main/jQuery/07_CSS%E6%93%8D%E4%BD%9C4_outerWidthouterHeight.html
1.01 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Document</title> | |
| <script src="./js/jquery-3.6.0.min.js"></script> | |
| <style> | |
| .box{ | |
| width: 200px; | |
| height: 200px; | |
| background-color: red; | |
| padding: 20px; | |
| border: 10px solid green; | |
| margin: 30px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="box"></div> | |
| <script> | |
| // 获取一个div的宽度高度+padding+border | |
| var height1 = $(".box").outerHeight(); | |
| var width1 = $(".box").outerWidth(); | |
| console.log(height1,width1); // 260 260 | |
| // 获取一个div的宽度高度+padding+border+margin | |
| var height2 = $(".box").outerHeight(true); | |
| var width2 = $(".box").outerWidth(true); | |
| console.log(height2,width2); // 320 320 | |
| </script> | |
| </body> | |
| </html> |