[OpenLayers-Dev] CSS

Tim Schaub noreply at geocartic.com
Wed Dec 13 12:40:43 EST 2006


I was hoping to get feedback from others on the state of OpenLayers
"skinability."

Excuse me if I'm wrong about this, but this is my perception of the state of
things:

With the current "on demand" stylesheet loading, a single map property
(theme) determines the location of the stylesheet.  This single stylesheet
is loaded when the map is initialized.  When the styles are actually applied
can't really be determined.  To customize the style of a single element, you
would edit the style.css or make your own copy.

I think this takes away a good bit of the power of CSS.  I know there is a
lot of emphasis on the single file library feature, but I think that a
commitment to this feature actually takes away a lot of potential
flexibility.

If stylesheets were included as regular old <style> tags, that would make OL
a two tag library - but it would also invite all the flexibility of CSS.
Users who simply wanted to change the border width of a single class could
include inline style declarations after the main style tag - overriding the
declarations of the default theme.

Also, controls (or any other component of the application) could traverse
the stylesheets and determine properties of their own style.  Currently,
this can't be done elegantly because the theme loading takes place at an
unknown time after the page loads.  Style declarations in traditionally
included style tags are available after the document loads.

I see all kinds of reasons to finish the class naming and make OL really
skinnable.  I also think it makes sense to take advantage of the cascading
nature of CSS.  I'm interested to hear what others think.

Tim




More information about the Dev mailing list