透過 CSS 使用百分比設定影像的高度和寬度
要使用 % 來設定影像的高度和寬度,你可以嘗試執行以下程式碼 -
示例
<!DOCTYPE html> <html> <head> <style> img { height: 50%; width: 50%; } </style> </head> <body> <p>Sized image in %</p> <img src = "https://tutorialspoint.tw/videotutorials/assets/videos/courses/155/images/course_155_image.png" alt = "CSS" width = "200" height = "200"> </body> </html>
廣告