將 CSS 寬度屬性用於自適應影像
將 width 屬性設為 100% 以獲得響應式影像。可嘗試執行以下程式碼,使影像具有響應性
示例
<!DOCTYPE html>
<html>
<head>
<meta name = "viewport" content="width=device-width, initial-scale = 1.0">
<style>
img {
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>
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP