Re: Weird table alignment override in website docs style - Mailing list pgsql-www

From David G. Johnston
Subject Re: Weird table alignment override in website docs style
Date
Msg-id CAKFQuwbuu8NhhC3DiWxUPCj9=r6b6O=46YaT=UpV7CiHqpCMpw@mail.gmail.com
Whole thread Raw
In response to Re: Weird table alignment override in website docs style  ("Jonathan S. Katz" <jkatz@postgresql.org>)
Responses Re: Weird table alignment override in website docs style  ("Jonathan S. Katz" <jkatz@postgresql.org>)
List pgsql-www
On Tue, Apr 14, 2020 at 2:53 PM Jonathan S. Katz <jkatz@postgresql.org> wrote:
On 4/14/20 5:40 PM, Tom Lane wrote:
> "Jonathan S. Katz" <jkatz@postgresql.org> writes:
>> The fix is now live:
>>      https://www.postgresql.org/docs/devel/functions-enum.html
>
> Hm, looking at
>
> https://www.postgresql.org/docs/devel/functions-enum.html
>
> it seems like it's now handling valign=middle for the "Function"
> header, but it's still ignoring align=center for all the headers.

Oops I missed that, sorry.

Doing some research, and from what I recall, align/valign as HTML
properties are technically no longer supported in HTML5 -- you are
supposed to handle this with CSS (text-align & vertical-align
respectively)[1]. The main reason it still works is that browsers still
support that backwards compatibility.

I do have a fix on my local that accounts for this using CSS attribute
selectors to check for that value and then apply it as CSS and it is
safe across browsers. I do wonder if it's more prudent to have a class
on it that I can check for?

I would suggest adding a class to the table element designating this as a "v12" style table.  Then something like the following would (untested) just work:

table.v12 > thead > tr > th {
text-align: center,
vertical-align: middle
}

Adding semantic classes to the other elements, namely the <th>, would work too and allow for more precision and less potential for conflicts.

I do think (though not really knowing the existing state) that regardless of the precision for the sub-table selectors that these tables should probably have new css rules created for them and those rules limited to applying only to properly classed tables.  Being as they should be more selective than existing table related selectors the newly added rules should then also take precedence.  And newly added rules here won't impact the body of existing tables that we have - not all of which I would presume are going to change.

David J.

pgsql-www by date:

Previous
From: Tom Lane
Date:
Subject: Re: Weird table alignment override in website docs style
Next
From: "Jonathan S. Katz"
Date:
Subject: Re: Weird table alignment override in website docs style