not in container

我试图使图片停留在左列中,但它似乎没有停留。如您所见,它悬停在桌子上。我怎样做才能使其留在桌子上?



<table align="center" style="width:550px" id="table" cellpadding="5">
  <tr>
    <th style="text-align: left" rowspan="2">
      <img src="avi.png" alt="" id="avatar" />
    </th>
    <th style="text-align: left">
      <h1 id="hello">My Resume</h1>
    </th>
  </tr>
  <tr>
    <td style="text-align: left">
      <p>Hello this is a crazy little test that i am doing to see if this code works</p>
    </td>
  </tr>
</table>

最佳答案

如果您特别想要类似您所给出的示例的内容,则使用表是一种笨拙的老方法。我建议使用flexbox,这是排列事物并使它们看起来不错的一种简单方法。

这是一个例子:



body {
  font-family: 'Helvetica Neue', Helvetica, sans-serif;
}
.resume {
  display: flex;
  align-items: center;
  justify-content: center;
}
.resume-picture {
  border: 10px solid #1976D2;
  border-radius: 50%;
  background: #f3f2f1;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
  height: 175px;
}
.resume-content {
  padding: 0 15px;
}
.resume-content h2 {
  color: #1976D2;
  margin-top: 0;
}
.resume-content p {
  color: #333;
  margin: 0;
}

<div class="resume">
  <img class="resume-picture" src="https://avatars2.githubusercontent.com/u/3534427?v=3" />
  <div class="resume-content">
    <h2>My Resume</h2>
    <p>Hello this is a crazy little test that i am doing to see if this code works.
      <br>Hello this is a crazy little test that i am doing to see if this code works.
      <br>Hello this is a crazy little test that i am doing to see if this code works.</p>
  </div>
</div>





我希望这是您要寻找的东西。

10-07 12:47