layout: Implement <table width> and <center>.

Improves Hacker News.
This commit is contained in:
Patrick Walton 2015-05-07 18:09:57 -07:00
parent 263b69cf7f
commit 4b9cd4e65d
13 changed files with 160 additions and 36 deletions

View file

@ -11,7 +11,6 @@ pre[wrap] { white-space: pre-wrap; }
FIXME: also "align descendants"
https://html.spec.whatwg.org/multipage/#align-descendants
*/
center, div[align=center i], div[align=middle i] { text-align: center; }
div[align=left i] { text-align: left; }
div[align=right i] { text-align: right; }
div[align=justify i] { text-align: justify; }

View file

@ -19,6 +19,17 @@ table {
font-size: initial;
line-height: initial;
white-space: initial;
/* text-align: initial; -- see FIXME below */
}
/*
* FIXME(pcwalton): Actually saying `text-align: initial` above breaks `<table>` inside `<center>`
* in quirks mode. This is because we (following Gecko, WebKit, and Blink) implement the HTML5
* align-descendants rules with a special `text-align: -servo-center`. `text-align: initial`, if
* placed on the `<table>` element per the spec, would break this behavior. So we place it on
* `<tbody>` instead.
*/
tbody {
text-align: initial;
}

View file

@ -19,3 +19,5 @@ td[align="left"] { text-align: left; }
td[align="center"] { text-align: center; }
td[align="right"] { text-align: right; }
center, div[align=center i], div[align=middle i] { text-align: -servo-center; }