en.javascript.info/03-more/11-css-for-js/06-css-center/03-vertical-align-table-cell-position/task.md
Ilya Kantor f301cb744d init
2014-10-26 22:10:13 +03:00

28 lines
No EOL
790 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# vertical-align + table-cell + position = ?
[importance 5]
В коде ниже используется вертикальное центрирование при помощи `table-cell + vertical-align`.
Почему оно не работает? Нажмите на просмотр, чтобы увидеть (стрелка должна быть в центре по вертикали).
```html
<!--+ run height=70 -->
<style>
.arrow {
position: absolute;
height: 60px;
border: 1px solid black;
font-size: 28px;
*!*
display: table-cell;
vertical-align: middle;
*/!*
}
</style>
<div class="arrow">«</div>
```
Как починить центрирование при помощи CSS? Свойства `position/height` менять нельзя.