源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>开源教程(ossoft.cn)</title> <style> .div1 { width: 300px; height: 100px; border: 1px solid blue; box-sizing: border-box; } .div2 { width: 300px; height: 100px; padding: 50px; border: 1px solid red; box-sizing: border-box; } </style> </head> <body> <div class="div1">两个 div 现在是一样大小的!</div> <br> <div class="div2">开源教程!</div> </body> </html>
运行结果