Home > Backend Development > PHP Tutorial > 页面能自适应手机屏幕大小,在里面的图片不能

页面能自适应手机屏幕大小,在里面的图片不能

WBOY
Release: 2016-06-23 13:59:59
Original
1526 people have browsed it



html 已经加了


内容是从数据库里读取的,整个页面及文本都可以自适应,但里面的图片就不会自适应大小,请问如何处理?


回复讨论(解决方案)

设置图片的百分比宽度

内容是从数据库读出来的(是html代码),设置不了图片的属性。

用js去改变可以

加个样式便可自适应。

  <style type="text/css">   .img{text-align:center;}   .img img{width:90%;}  </style>  <p class="img"><img  src="test.jpg" alt="页面能自适应手机屏幕大小,在里面的图片不能" ></p>
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template