html - 在我的案例中如何水平对齐文本和图像

标签 html css alignment

我试图让我的文字与图像保持在同一水平面上

我有类似的东西

<div>
    <img src='test.png'/>
    <a href='#'>This is the test here</a>
</div>

显示

 -----
|     |     This is the test
|     |
 -----

here

 -----
|     |     This is the test
|     |     here
 -----

我该如何解决这个问题?谢谢!

最佳答案

div {
    clear:both;
    float:left;
}
div img{
    float:left;
}

div a{
    float:left;
}

关于html - 在我的案例中如何水平对齐文本和图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22997274/

相关文章:

javascript - 在所有四个方向上移动一个 div

css - Bootstrap 导航栏在 css 中的定位

javascript - 如何在Jquery Mobile中居中对齐两张图片

html - 按钮在 Firefox 中对齐,但在 Chrome 中不对齐

html - 移动和桌面布局上的 CSS 显示

javascript - 在定义之前读取环境变量

javascript - 根据 AngularJS 中另一个选择元素的值设置选择选项

Python Jupyter notebook SHAP force_plot,如何在深色主题中改变背景颜色或文字颜色?

html - CSS 最小宽度和最大宽度问题

javascript - 如何修复 div 类 ="row"angular + bootstrap 中的元素