简体   繁体   中英

Make td align to top of table

Hi everybody lets first start me example on fiddle I used part of my project on studies:

https://jsfiddle.net/onpfb83g/

the css is pretty basic:

body {
  background-color: white;
  font-family: Arial;
}

.box h1 {
  color: navy;
  margin-left: 20px;
  text-align: center;
  display: block;
  font-size: 2em;
  -webkit-margin-before: 0.67em;
  -webkit-margin-after: 0.67em;
  -webkit-margin-start: 0px;
  -webkit-margin-end: 0px;
  font-weight: bold;
}

.box {
  width: 480px;
  height: 480px;
  position: relative;
}

.box table {
  display: table;
  border-collapse: separate;
  border-spacing: 2px;
  border-color: grey;
}

.box .images td {
  padding: 0px;
  border-left: none;
  border-right: none;
  background-color: white;
  text-align: center;
  font-size: 90%;
  font-style: italic;
  font-weight: bold;
}

.box .images img {
  width: 100px;
  height: 100px;
}

.box .attributes td {
  margin-top: 0;
  padding-top: 0;
  border-left: none;
  border-right: none;
  background-color: white;
}

.box .attributes td {
  border-bottom: 1px solid #ddd;
}

.box .even td {
  background-color: #eee;
  border-bottom: none;
}

.box .odd td {
  background-color: white;
  border-bottom: none;
}

.box .actions {
  margin: 40px
}

.box .expander {
  width: 30px;
  height: 30px;
  position: absolute;
  bottom: 0px;
  right: 0px;
}

.header {
  background-color: #ccc;
  border-bottom: 3px solid #999;
  border-top: 3px solid #999;
  font-weight: bold;
  font-style: italic;
  position: absolute;
}

#summary_row {
  height: 100px;
  font-size: 110%;
}

#summary_cpn {
  color: #F00;
  font-weight: bold;
}

.box .thumbnail:hover {
  position: relative;
  top: 25px;
  left: 35px;
  width: 150%;
  height: auto;
  display: block;
  z-index: 999;
  box-shadow: 10px 10px 5px #888888;
}

You can see that table with text "Graphic"isn't as the same "level" as a first row "test desc" my question is, what have I done wrong how can I align this second column to up ? I tried using padding-top: 0, margin-top:0 but that don't give any results

Move <p>Graphic</p> in to a new tr

    <tr>
        <td colspan="3">
          <p>Graphic</p>
        </td>
      </tr>
      <tr>
        <td class="images">
          <img class="thumbnail" src="https://disastersafety.org/wp-content/uploads/SXC-Test-Graphic-1335048_63274538.jpg">
        </td>
</tr>

Updated Fiddle

try adding these rules:

.column-header {  
  vertical-align: top;
}

.images p {
  margin: 0;
}

https://jsfiddle.net/onpfb83g/2/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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