html - 当我更改页脚宽度时,文本一直向右移动
问题描述
我做了这个面包网站,在页脚。更改页脚时,我发现文本随着页脚不断向右移动。我如何将文本保留在图像旁边?
footer {
clear: both;
background-color: brown;
color: white;
padding: 5px 20px;
width: 700px;
max-width: 100%;
}
<main>
<img src="https://onlycrumbsremain.com/wp-content/uploads/2020/10/dinner-roll-9.jpg" alt="10 kinds of bread" width="400" height="300" align="left">
<p>Lorem ipsum...</p>
<img src="https://imgix.bustle.com/mic/kwojkqt6twmbxd7d525gm9bzrcfnccm940okdfbtbxc3c3lnchh2v6bh907bdigs.jpg?w=1200&h=630&fit=crop&crop=faces&fm=jpg" alt="10 kinds of bread" width="400" height="300" align="right">
<p>Lorem ipsum...</p>
<footer>
<p>© 2021 Private Bread | The best online bread store!</p>
</footer>
</main>
解决方案
我想你可能希望你<footer>
在你之外<main>
:
footer {
clear: both;
background-color: brown;
color: white;
padding: 5px 20px;
width: 700px;
max-width: 100%;
}
<main>
<img src="https://onlycrumbsremain.com/wp-content/uploads/2020/10/dinner-roll-9.jpg" alt="10 kinds of bread" width="400" height="300" align="left">
<p>Lorem ipsum...</p>
<img src="https://imgix.bustle.com/mic/kwojkqt6twmbxd7d525gm9bzrcfnccm940okdfbtbxc3c3lnchh2v6bh907bdigs.jpg?w=1200&h=630&fit=crop&crop=faces&fm=jpg" alt="10 kinds of bread" width="400" height="300" align="right">
<p>Lorem ipsum...</p>
</main>
<footer>
<p>© 2021 Private Bread | The best online bread store!</p>
</footer>
推荐阅读
- android - 如何限制用户访问 Firebase Firestore 中的数据库?
- javascript - 渲染、GraphQL、Nextjs 和 Reactjs 没有返回任何内容
- google-cloud-platform - Cloud Run http 到 https 重定向
- javascript - 获取后如何在 DOM 上更新另一个函数中 div 的值
- javascript - 将 curl 与变量一起使用
- sql-server - EF Core Code First - 没有 Id 的一对多关系
- python - Python 3.9.1 - 使用 StandardScaler() 缩放单行浮点数
- javascript - Storybook react-native 检查 `CellRenderer` 的渲染方法
- swift - 更改焦点元素的颜色 (Picker) SwiftUI - WatchOS
- php - 将数据连接到谷歌数据工作室