Cannot align text and image side by side?

This question already has an answer here:

  • Vertically align text next to an image? 20 answers

  • 尝试在这里使用Flexbox ...并将您的右侧内容封装到一个div中,以获得更好的练习和可读性

    .card1 {
      display: flex;
      align-items: flex-start;
    }
    
    h6 {
      margin-top: 0;
    }
    
    .item {
      padding-left: 10px;
    }
    <div class="card1">
      <img className="javacardimg" src="http://via.placeholder.com/100x100?text=JAVA" alt="Java">
      <div class="item">
        <h6 className="cardtitle1">New Launch</h6>
        <p className="cardcontent1">JAVA Foundations</p>
      </div>
    </div>
    链接地址: http://www.djcxy.com/p/41548.html

    上一篇: 对齐:中间不工作

    下一篇: 不能对齐文本和图像?