html - 将图像定位在屏幕左侧
问题描述
我想并排放置我的文本和图像。现在,文本位于图像的左侧。要将文本向右移动,我可以更改
<aside>
我如何将图像移动到左侧?
<aside style="background-image: url(img/s-esh_spectrogram.jpg);"> </aside>
解决方案
在您的部分周围设置一个包装器并display: flex
在其上设置 CSS 属性。
进一步阅读:https ://www.w3schools.com/css/css3_flexbox.asp
.wrapper {
display: flex;
}
section.text-section {
height: 300px;
width: 60%;
background: #82fcf5;
}
aside.image-section {
height: 300px;
width: 40%;
background: #c8fc55;
}
<div class="wrapper">
<aside class="image-section" style="background-image: url(img/s-esh_spectrogram.jpg);">
<p>Image here...</p>
</aside>
<section class="text-section">
<p>Text here...</p>
</section>
</div>
推荐阅读
- c - 使用 MPI (C) 发送和接收 3D 矩阵
- arrays - 在 Groovy 中动态创建二维数组
- reactjs - React:从先前的状态构建动态表单并在其上处理错误。状态错误
- c# - 'system.stackoverflowexception' 类型的异常在 c# 中被 OpenGL 抛出
- c# - 为什么物体向下移动而不是向上移动?
- python-3.x - ldap3 查询组用户不返回用户数据
- c# - C# 获取文件类型的默认应用程序
- javascript - Native Base 如何获取 List dataArray 的 ListItem 索引?
- python-3.x - 如何在python 3.6.5中通过变量创建子元素
- sql - 在 FROM 子句中使用 RIGHT JOIN 时出现无效标识符错误