使用 CSS max-width 屬性以實現響應式影像
你可以嘗試執行以下程式碼來為響應式影像實現 max-width 屬性
示例
<!DOCTYPE html>
<html>
<head>
<meta name = "viewport" content = "width = device-width, initial-scale = 1.0">
<style>
img {
max-width: 100%;
height: auto;
}
</style>
</head>
<body>
<p>To check the effect, you need to resize the browser.</p>
<img src = "https://tutorialspoint.tw/python/images/python-data-science.jpg" alt = "Python Data Science" width = "400" height = "300">
</body>
</html>
廣告
資料結構
網路
關係資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP