源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>编程字典</title> <style> div { width: 320px; padding: 10px; border: 5px solid gray; margin: 0; } </style> </head> <body> <h2>计算总宽度:</h2> <img src="klematis4_big.jpg" width="350" height="263" alt="Klematis"> <div>上面的图片是350px宽。该元素的总宽度也350px.</div> </body> </html>
运行结果