MediaWiki talk:Common.css/Archives/2007

From Meta, a Wikimedia project coordination wiki

Bloated CSS

  • What's so special about {{other languages}} (with less than 500 inclusions) that this code needs to be inlcuded in a global CSS file?
#otherlangs {
      margin:0.5em;
      padding:2px;
      border:1px solid #CCC;
      background:#FAFAFA;
      font-size:0.9em;
    }
Well, the template is going through a bit of an overhaul, as per a discussion at Metapub#Standardizing language templates. I'm not sure what the problem with including the CSS in the global file is, especially since it's not much code at all. EVula // talk // // 19:23, 27 October 2007 (UTC)
Hello. The difference in coding size is substantial; adding 340 bytes (cached) to the stylesheet removes 1791 bytes (uncached) from Board elections/2007. The 340 bytes in the stylesheet are downloaded once and cached, but the 1791 bytes with inline CSS are redownloaded on every page load. Since {{other languages}} is the standard template for translation interlinking, it's used on many of the most viewed pages and its usage is steadily increasing. If a user visits even one page with translations, this significantly reduces the amount to transfer.
Even before client-side downloading, the smaller template code means it uses a fraction of the server resources to parse— the server currently reads through 2550 redundant bytes of inline CSS, and that's before the user even receives the page. I think the benefits of adding the CSS to the stylesheet far outweigh the slight 340-byte disadvantage.
As for the spacing attribute, that has nothing to do with the {{other languages}} CSS. I don't know what attribute the author meant; try asking whoever added it to fix it. —{admin} Pathoschild 01:49:38, 28 October 2007 (UTC)
Let's see. There are 3 CSS rules there. My question was specifically about the first part (which I quoted above), which in my opinion should have stayed inline CSS.
Your answer covered the second part (#otherlangs span), which indeed saves a lot of inline styling and I'm not going to argue with that.
Please note that I also object to the last part (#otherlangs span.firstlang { border:none; }): if the template knows that the first span should have no border, it should make it without border without the need for global CSS.
As for the spacing attribute, I simply mentioned it so you could remove it along with your next Common.css revision. It doesn't do anything at all (except triggering CSS errors in console) ∴ Alex Smotrov 16:12, 29 October 2007 (UTC)