A small CSS optimisation

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The current feature release of phpBB 3 is 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
TerryE
Registered User
Posts: 95
Joined: Sat May 23, 2009 12:24 am
Contact:

A small CSS optimisation

Post by TerryE »

At the moment the core generated HTML document loads five styles: print.css, style.php?id=<style_no>&lang=<lang> and the three one-liners: normal.css, medium.css, large.css. Surely these last three are really just obsolete?
  1. All modern browsers allow you to change the base font size by zooming the text. Most users who do this use the ctrl+scroll wheel or a touchpad gesture. Few even realise that you can select alternative page styles.
  2. Some of the legacy browsers (e.g. MSIE6, IIRC) didn't even allow you access to non-default page styles.
I would agree that this would make more sense if the size CSS files were used for more than just specifying the base font size, but they aren't. So given that this feature is redundant, why not just drop the normal / medium / large CSS files and move the body {font-size: 10px;} into the style.php generated template?

Three less files to fetch if the CSS files aren't cached in the browser.

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Karlsruhe, Germany
Contact:

Re: A small CSS optimisation

Post by naderman »

I think this makes sense, waiting for a patch ;-)

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1856
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: A small CSS optimisation

Post by DavidIQ »

naderman wrote:I think this makes sense, waiting for a patch ;-)
+1
Image

User avatar
bantu
3.0 Release Manager
3.0 Release Manager
Posts: 557
Joined: Thu Sep 07, 2006 11:22 am
Location: Karlsruhe, Germany
Contact:

Re: A small CSS optimisation

Post by bantu »

DavidIQ wrote:
naderman wrote:I think this makes sense, waiting for a patch ;-)
+1
+1

TerryE
Registered User
Posts: 95
Joined: Sat May 23, 2009 12:24 am
Contact:

Re: A small CSS optimisation

Post by TerryE »

This one isn't quite as simple as I suggested because of the current implementation of styleswitcher.js which is attached to the resize button at the right of the header crumb-trail bar. This currently uses a function setActiveStyleSheet(sheet) to cause the change and this uses the DOM to change the documents stylesheet.

I've had a look at a couple of examples of how other pages provide such zoom features without the stylesheet variants, and these either use the DOM to update the base style itself or walk the DOM to update the individual <p> et al tag font size attributes. There are functional subtleties here that need to be considered relating to scope and persistence. I've put looking into this on my todo list.

User avatar
hanakin
Front-End Dev Team Lead
Front-End Dev Team Lead
Posts: 935
Joined: Sat Dec 25, 2010 9:02 pm
Contact:

Re: A small CSS optimisation

Post by hanakin »

the necessity for the button itself is not necessary and the complete removal of the styleswitcher has been proposed in the tracker and is already in the works via the jquery conversion.
Donations welcome via Paypal Image

TerryE
Registered User
Posts: 95
Joined: Sat May 23, 2009 12:24 am
Contact:

Re: A small CSS optimisation

Post by TerryE »

OK, let's kill this thread then and cover it as part of the jQuery and Prosilver optimisation discussions. :-)

Post Reply