[SOLVED] Change table's CSS to allow alignment override

Anything related to the content on our wiki (https://wiki.factorio.com/)

Moderator: Bilka

vadcx
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Fri Apr 19, 2024 4:12 pm
Contact:

[SOLVED] Change table's CSS to allow alignment override

Post by vadcx »

EDIT: See the second post, it was an initial mistake in table formatting.

https://en.wikipedia.org/wiki/Wikipedia ... formatting shows how you can specify custom CSS for tables.

On Recycler's page its' outputs are hard to read because they are centered. I have attempted a custom style and it turned out to not work: https://wiki.factorio.com/index.php?tit ... did=203961 ... I only submitted the change because I fooled myself by getting it to work after I modified the page styles in DevTools.

The following would preserve the old styling by default and allow such overrides to work:

https://wiki.factorio.com/load.php?lang ... vectordark

Code: Select all

.wikitable > tr > th, .wikitable > * > tr > th {
	background-color: #eaecf0;
	text-align: inherit; /* --> changed from center to be controlled by .wikitable or in-page user style */
}
Add:

Code: Select all

.wikitable {
/* makes sure table headings remain centered; and to have an effect on inherit IF not overriden by in-page user style */
	text-align: center;
}
When you carry out these modifications in DevTools, my "text-align: left" begins to work (!important isn't needed) yet headings remain centered as expected.

It's possible I'm doing something wrong or such level of detail is not desired :roll:
Last edited by vadcx on Thu Oct 31, 2024 12:52 pm, edited 1 time in total.
vadcx
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Fri Apr 19, 2024 4:12 pm
Contact:

Re: Change table's CSS to allow alignment override

Post by vadcx »

Nevermind, Untitled7 fixed it :lol: https://wiki.factorio.com/index.php?tit ... did=203961

The table data rows were previously defined as "!" aka table headers. He changed it to "|" which stand for table data rows. https://www.mediawiki.org/wiki/Help:Tables I will change the thread title accordingly.
untitled7
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sat Oct 26, 2024 12:51 pm
Contact:

Re: Change table's CSS to allow alignment override

Post by untitled7 »

vadcx wrote: Thu Oct 31, 2024 12:51 pm Nevermind, Untitled7 fixed it :lol: https://wiki.factorio.com/index.php?tit ... did=203961

The table data rows were previously defined as "!" aka table headers. He changed it to "|" which stand for table data rows. https://www.mediawiki.org/wiki/Help:Tables I will change the thread title accordingly.
yeah, styling in the opener of the table apply generally, but they get overwritten by the more specific selectors
I altered that table further now, to not be a table in a table
Post Reply

Return to “Wiki Talk”