简体   繁体   English

如何在我的情况下水平对齐文本和图像

[英]How to horizontal align texts and image in my case

I am trying to keep my texts next to an image on the same horizontal level 我正在尝试将文字保持在同一水平线上的图像旁边

I have something like 我有类似的东西

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

it shows 表明

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

here

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

How do i fix this? 我该如何解决? thanks! 谢谢!

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

div a{
    float:left;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM