→Redundant CSS: Reply |
→Redundant CSS: Reply |
||
| (2 intermediate revisions by one other user not shown) | |||
| Line 8: | Line 8: | ||
:As far as I am aware, the CSS is identical to the chart I added to the [[Safe_spots#Making_A_Safe_Spot_Off_D-Scan_Using_Navigators|safe spots page]] (except that this chart is sortable and that one isn't), so if you can edit that page to show what piece of CSS is redundant, I can copy that work over to this page. [[User:Ashling Solette|Ashling Solette]] ([[User talk:Ashling Solette|talk]]) 23:00, 23 July 2025 (UTC) | :As far as I am aware, the CSS is identical to the chart I added to the [[Safe_spots#Making_A_Safe_Spot_Off_D-Scan_Using_Navigators|safe spots page]] (except that this chart is sortable and that one isn't), so if you can edit that page to show what piece of CSS is redundant, I can copy that work over to this page. [[User:Ashling Solette|Ashling Solette]] ([[User talk:Ashling Solette|talk]]) 23:00, 23 July 2025 (UTC) | ||
::OK. let me see if I can explain this a bit more clearer. On the page there are 2 places where there is a <nowiki>{{#CSS}}</nowiki> block. Coincidentally these 2 blocks have identical content. The position of a <nowiki>{{#CSS}}</nowiki> block has no relation as to where on the page the CSS is valid. Any CSS is valid on the whole page. The only thing that the position is valid for is that by identical selectors the last one loaded is the one who's content is applied, there are some more things which might influence this but for this situation they do not apply. So what is in the second block will "overwrite" what is in the first block. Because the content from the 2 blocks is identical this effectively makes 1 of the blocks redundant. So in this case only one of the blocks is needed. For the TL;DR [https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_cascade/Cascade Introduction to the CSS cascade] might be a good starting point. -- [[User:Evon R'al|Evon R'all]] ([[User talk:Evon R'al|talk]]) 09:40, 24 July 2025 (UTC) | ::OK. let me see if I can explain this a bit more clearer. On the page there are 2 places where there is a <nowiki>{{#CSS}}</nowiki> block. Coincidentally these 2 blocks have identical content. The position of a <nowiki>{{#CSS}}</nowiki> block has no relation as to where on the page the CSS is valid. Any CSS is valid on the whole page. The only thing that the position is valid for is that by identical selectors the last one loaded is the one who's content is applied, there are some more things which might influence this but for this situation they do not apply. So what is in the second block will "overwrite" what is in the first block. Because the content from the 2 blocks is identical this effectively makes 1 of the blocks redundant. So in this case only one of the blocks is needed. For the TL;DR [https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_cascade/Cascade Introduction to the CSS cascade] might be a good starting point. -- [[User:Evon R'al|Evon R'all]] ([[User talk:Evon R'al|talk]]) 09:40, 24 July 2025 (UTC) | ||
:::The in-line CSS falls under the <nowiki><th> tag, not the <td></nowiki> tag, and the CSS block at the top of the chart only applies to the <nowiki><td></nowiki> tags. Therefore it is not redundant. | |||
:::Also, I have not figured out a clean way to reference the last <nowiki><tr></nowiki> containing a <nowiki><th> in the CSS block, so it will stay in-line for the time being. I suppose tr:last-child will work in this instance, but that would not work if you wanted subtotals partway down the chart - which would have <th> in the middle somewhere that would need different CSS from the <th> at the top of the chart.</nowiki> [[User:Ashling Solette|Ashling Solette]] ([[User talk:Ashling Solette|talk]]) 22:11, 2 August 2025 (UTC) | |||
:::Ok, I think I figured it out - I was looking at each chart individually, but not the page as a whole, so I was missing the big picture view. Sorry if my last comment sounded a bit sharp. [[User:Ashling Solette|Ashling Solette]] ([[User talk:Ashling Solette|talk]]) 23:29, 2 August 2025 (UTC) | |||
::::No problem. I always have some difficulty explaining stuff in writing. Thing with CSS is you can never look at one bit in isolation and be sure what happens; that's the cascading part in the name. As for referencing the "last" <th> as you mentioned, there is inline (last resort for me) and tr:last-child, but that is a bit more complicated than just tr:last-child, as not all the <th> are the same. But there is also the option to use a class. I hope you don't mind too much, but I did a proof of concept on combination 1. As the class can be placed wherever you want, it will work for a subtotal mid-table too. As a side note: a subtotal mid-table will probably get in trouble with the sorting part. -- [[User:Evon R'al|Evon R'all]] ([[User talk:Evon R'al|talk]]) 10:21, 3 August 2025 (UTC) | |||