html - 如何使 img 标签中的照片大小合适以适合屏幕比例?

标签 html css stylesheet

我有这个照片页面:

http://www.comehike.com/hikes/hike_image.php?hike_photo_id=106&photo_path=http://www.comehike.com/img/hiking_photos/-1_311_5/full_IMG_4612.jpg

如您所见,图片比屏幕大得多。有没有办法缩小照片以保持其长度和宽度的比例,同时又能很好地适合页面?

谢谢!

最佳答案

在其样式中添加width:100%


<img src="http://www.comehike.com/img/hiking_photos/-1_311_5/full_IMG_4612.jpg" style="border: none; width: 100%;" alt="California Nature" />

关于html - 如何使 img 标签中的照片大小合适以适合屏幕比例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6256733/

相关文章:

javascript - 防止 td contenteditable 中的跨度

javascript - php回显元素不改变高度

javascript - 在每个 src 或 href 自动值 "$1"$0

html - css 设计因浏览器而异为什么?

html - 如何在没有内容的情况下将div宽度设置为完整?

html - 水平下拉菜单的子菜单不垂直

html - ie8 + CSS : using -ms-filter in inline style

css - Rails 4 添加样式表

iphone - 更改 Three20 导航栏 TintColor 导致图像库缩略图 View 顶部出现间隙

html - 如何在末尾显示带图像的虚线?