Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTMLTable*Element.{valign|align} #33035

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Fix comments about vertical-align
  • Loading branch information
teoli2003 committed Apr 12, 2024
commit 076f6aba0db6f82a1077bc3b5b61b991eda1eb54
43 changes: 30 additions & 13 deletions files/en-us/web/css/vertical-align/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,25 +198,26 @@ p {

### Vertical alignment in a table cell

In this example, we have a table with a single row containing six cells. The row sets `vertical-align` to `bottom` as the default value.

- The first four cells each set their own `vertical-align` values, and these override the row's value.
- The fifth cell does not set any `vertical-align` value, so inherits the row's value.

The sixth cell is only used to ensure that the cells are tall enough to see the effect.

#### HTML

```html
<table>
<tr style="vertical-align: bottom">
<td style="vertical-align: baseline">baseline</td>
<td style="vertical-align: top">top</td>
<td style="vertical-align: middle">middle</td>
<td style="vertical-align: bottom">bottom</td>
<tr class="bottom">
<td class="baseline">baseline</td>
<td class="top">top</td>
<td class="middle">middle</td>
<td>bottom</td>
<td>Row's style</td>
<td>
<p>
There is a theory which states that if ever anyone discovers exactly
what the Universe is for and why it is here, it will instantly disappear
and be replaced by something even more bizarre and inexplicable.
</p>
<p>
There is another theory which states that this has already happened.
</p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
pretium felis eu sem mattis vulputate.
</td>
</tr>
</table>
Expand All @@ -241,6 +242,22 @@ td {
padding: 0.5em;
font-family: monospace;
}

.bottom {
vertical-align: bottom;
}

.baseline {
vertical-align: baseline;
}

.top {
vertical-align: top;
}

.middle {
vertical-align: middle;
}
```

#### Result
Expand Down