html - 图像移动响应式设计

标签 html css

目前,我正在尝试学习移动设备的响应式设计。我遇到的问题是,当增加浏览器大小时,我的图像缩放得很好。但是,它们往往会超出包含文本的框。我会提供一张图片,以便您可以看到问题所在。

如果有人对缩放时如何将图像正确保存在 div 中有任何想法,那将非常有帮助!谢谢!

enter image description here

这也是我的 Jsfiddle:https://jsfiddle.net/x1mn04p2/ (我将 img css 放在顶部,将网站的其余 css 放在下面,这样我就可以看到完整的外观)

HTML:

 <section>

 <div id="box">
<h1> GCOM 366</h1>
<section class="clearfix" id="primary">
<div class="imgbox">
 <img class="adjustable" src="weblogo" alt="example web page" width="300" heigh="300" style="float:right">
 </div>
 <h2> Benefits</h2>

 <p class="side">
1.  Learn industry standard programs
<br>
2.  Build Portfolio
<br>
3.  Increase collaboration skills
<br>
4. Become more creative 
<br>
5. Understand good layout
<br>
6. Feel confident in HTML/CSS
</p>
</section>




img.adjustable{
 width: 100%;
 max-width: 400px;
 max-height: 400px;
    margin: 1em 1em 1em 2%;
    }

最佳答案

图像的右边距使一切变得复杂。去掉它。例如,不是向 .imgbox 添加右填充。

关于html - 图像移动响应式设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40699906/

相关文章:

html - 将 div 垂直居中到其兄弟 div

java - 读取Java中页面的源代码

javascript - 我正在尝试生成随机颜色(javascript)并在单击按钮时将结果应用到按钮。如何将 JS 与 Jquery 合并?

javascript - 模仿鼠标点击

javascript - 在html中点击显示和隐藏div

twitter-bootstrap - 如何在不同的视口(viewport)尺寸下停止改变 div 高度的文本长度

html - 如何将背景图像移到后面并将登录容器移到前面

html - 是否可以引用一次 svg 文件,然后多次使用它?

html - 当列/行是单个时,周围空间在 chrome 和 firefox 中的行为不同

javascript - 如何使用 jQuery 将面板菜单固定到位