首页 > 解决方案 > Meta viewport 在 phone 和 chrome 设备模式下完全没有效果

问题描述

大家好,我使用的是 html,但是当我<meta>在 head 中添加以下元素时,Viewport 在手机和 chrome 设备模式下不会改变:

<!DOCTYPE html>
<html>
<head>
	
	<title>phone</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

</head>
<body style="background-image: url('space.jpg')">
     <img src="https://www.drgoulu.com/wp-content/uploads/HLIC/c2281c83670e31d8aaab7cb642b824db.png">
     <p>Python est un langage de programmation objet, multi-paradigme et multiplateformes. Il favorise la programmation impérative structurée, fonctionnelle et orientée objet. Wikipédia</p>

</body>
</html>

有谁知道这可能是什么原因造成的?

标签: pythonhtmlcss

解决方案


尝试width: 100%放入img标签

# style.css

img {
    max-width: 100%;
    # or simple width
    # width: 100%;
}

或直接在img标签中

<img style="width: 100%" src="https://www.drgoulu.com/wp-content/uploads/HLIC/c2281c83670e31d8aaab7cb642b824db.png">

推荐阅读