原文:http://www.cnblogs.com/startfromit/archive/2010/12/29/1920706.html

问题:

制作了一个320像素宽的网页,但通过android浏览器查看时,发现定义的%宽度并不按照手机屏幕的宽度来显示(320px),浏览器缺省把网页看作具备一定宽度的网页(可能是640px)来查看,并出现水平和垂直的滚动条。

原因:

原网页指定的doctype为html4.0

解决方法:

将doctype改为 xhtml mobile profile后,问题解决。即:

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">

通过修改doctype后,网页能够支持手机浏览器转换屏幕,根据切换的分辨率,自动调整宽度%。

相关文章:

  • 2021-08-17
  • 2022-12-23
  • 2021-10-15
  • 2021-05-18
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
猜你喜欢
  • 2021-11-12
  • 2021-09-23
  • 2022-12-23
  • 2021-09-20
  • 2021-09-20
  • 2021-06-20
  • 2021-05-24
相关资源
相似解决方案