Arrggh! Don't overdesign templates

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Arrggh! Don't overdesign templates

Post by svasti » Sat Apr 26, 2014 7:42 pm

Just putting together a new plugin and I find that in some of the bundled templates the template-css simply goes too far.

Take for instance "structure1_black"

Code: Select all

img {...;vertical-align: bottom;... 
Now vertical-align:bottom affects all images and messes up the plugin. :twisted:
These things should be used in a more specific and limited way.

Or take "n6200tbisGPL3"

Code: Select all

.tbisgpl3-postcontent ul > li:before, .tbisgpl3-post ul > li:before, .tbisgpl3-textblock ul > li:before {
    content: url('images/postbullets.png');
    margin-right: 6px;
    bottom: 2px;
Too bad, all the content is in .tbisgpl3 and this css affects all lists !

The Plugin needs a huge stylesheet.css just to counteract all these overdesign. For the same reason a lot of code had to be added to the core.css to make the backend usable.
I think CMSimple_XH is not WordPress and templates also should be kept simple.

I propose to discuss some guidelines for templates.
Thus the core.css can be made smaller.
The template designers should see to it that the backend is usable.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Arrggh! Don't overdesign templates

Post by cmb » Sun Apr 27, 2014 4:00 pm

svasti wrote:These things should be used in a more specific and limited way.
I'm not sure, though, how to do that. E.g. styling lists in the template seems to be reasonable, but that could already result in unexpected styling of some plugins. Restricting the list styles to a certain class would require the user to set this class for all her lists.
svasti wrote:I propose to discuss some guidelines for templates.
ACK. I hope we can agree on some basic guidelines.

Any thoughts (especially from the template designers)?
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3587
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Arrggh! Don't overdesign templates

Post by Tata » Sun Apr 27, 2014 5:34 pm

I think that strict names of all system/core stylesheet selectors and also a convention to name all templates-stylesheet selector by author's unique prefix would solve it.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Arrggh! Don't overdesign templates

Post by cmb » Sun Apr 27, 2014 10:25 pm

Tata wrote:I think that strict names of all system/core stylesheet selectors and also a convention to name all templates-stylesheet selector by author's unique prefix would solve it.
I fully agree that both should be done (the former has been started for XH 1.6, and is further on the roadmap to 2.0; the rest is up to the template designer).

But is that sufficient? What if the template designer wants all unordered lists to have a certain bullet?

Code: Select all

ul > li {list-style-image:url(...)}
as well as

Code: Select all

#main ul > li {list-style-image:url(...)}
will affect plugins which use <ul> (consider e.g. Pagemanager or Slideshow, which use <ul> quite liberately).

While it is no problem for a plugin author to overwrite a few rules, there are far too much to overwrite nowadays (CMIIW).

The following more restricted variant would require the user to set the CSS class for the <ul> manually, what would rather be unconvenient for the user:

Code: Select all

ul.tpl_ul > li {list-style-image:url(...)}
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3587
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Arrggh! Don't overdesign templates

Post by Tata » Sun Apr 27, 2014 11:03 pm

cmb wrote:The following more restricted variant would require the user to set the CSS class for the <ul> manually, what would rather be unconvenient for the user:

Code: Select all

ul.tpl_ul > li {list-style-image:url(...)}
That's exactly what I ment.
Drop short conventioin note in readme.txt as how to give names to all specific selectors used in templates and plugins.
1. selector.plugin_prefix > subselector{...}
2. selector.tpl_selector > subselector{...}
etc.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: Arrggh! Don't overdesign templates

Post by svasti » Sun Apr 27, 2014 11:16 pm

cmb wrote:styling lists in the template seems to be reasonable
my point is to distinguish between what is reasonable and what is not. A plugin author should expect a reasonable variation of settings. However sometimes there are some very unusual and unexpected settings which the plugin author does not anticipate and which break plugins unnecessarily.

For the mail form I would have liked to give the textarea 100% width in the core.css. It would have been nice if the area would occupy the normal full width of the normal text. However this didn't work with "n6200tbisGPL3": here the text areas were shifted to the right and 100% width would overlapp the content to the right. Looked quike ugly.
The point is: Why is it necessary to shift ALL text areas? If the template author wants to have a special effect somewhere in his plugin, he should limit it to that specific area.

Another example is "structure1_black" with vertical-align: bottom to all images. This effects all images the user puts into the text. Why is ist necessary to have vertical-align:bottom to all images? If the template author wants some template images to have vertical-align:bottom, it should be limited to that special case.

In my plugin I wanted to put images and text into ul > li. I thought .plugin ul {list-style-type: none;list-style-image: none;} would be enough. However things are MUCH more complicated: "structure1_black" requires also .plugin ul li img {vertical-align: initial;} and "n6200tbisGPL3" .plugin ul li:before {content:none !important;}. Yes, !IMPORTANT, otherwise the list-style-images won't go away, and still there remains a big left border which I haven't figured out how to get rid of.
Tata wrote:I think that strict names of all system/core stylesheet selectors and also a convention to name all templates-stylesheet selector by author's unique prefix would solve it.
In 1.6 we started like this and the mail form has selectors like #xh_mailform and .xh_mailform. Also "n6200tbisGPL3" has .tbisgpl3 before everything — still, as the mailform is inside the content area, the #xh_mainform textarea is dependend on the preceding .tbisgpl3 definition, because css is cascading.

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: Arrggh! Don't overdesign templates

Post by svasti » Mon Apr 28, 2014 10:46 am

I have been working with Thorstens template n6200tbisGPL3 a bit more and the problem is, that this template has 4 (yes FOUR) css files and is loading some of these css files after the plugin css is loaded.

So there is no chance for a plugin css, since these values will be overwritten by his subsequent extra template css. Except plugin css values add !important. However that should be avoided.

mikey
Site Admin
Posts: 179
Joined: Tue May 27, 2008 3:15 am
Location: Sydney Australia

Re: Arrggh! Don't overdesign templates

Post by mikey » Mon Apr 28, 2014 11:19 am

ok, this thread has my attention ;)

since all of my templates only use base cmsimple css, i guess mine have no problems that you describe ;)

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Arrggh! Don't overdesign templates

Post by cmb » Mon Apr 28, 2014 11:31 am

svasti wrote:my point is to distinguish between what is reasonable and what is not. A plugin author should expect a reasonable variation of settings. However sometimes there are some very unusual and unexpected settings which the plugin author does not anticipate and which break plugins unnecessarily.
Okay. However, when I look at Chrome's developer tools, there are currently 253 valid CSS properties for <li>...
svasti wrote:For the mail form I would have liked to give the textarea 100% width in the core.css. It would have been nice if the area would occupy the normal full width of the normal text. However this didn't work with "n6200tbisGPL3": here the text areas were shifted to the right and 100% width would overlapp the content to the right. Looked quike ugly.
The point is: Why is it necessary to shift ALL text areas? If the template author wants to have a special effect somewhere in his plugin, he should limit it to that specific area.
The shift is caused by padding + border in this case, and it is not unreasonable to specify both properties for all textareas to achieve a consistent look.[1]
svasti wrote:In 1.6 we started like this and the mail form has selectors like #xh_mailform and .xh_mailform. Also "n6200tbisGPL3" has .tbisgpl3 before everything — still, as the mailform is inside the content area, the #xh_mainform textarea is dependend on the preceding .tbisgpl3 definition, because css is cascading.
Indeed, that is our basic problem here.
svasti wrote:I have been working with Thorstens template n6200tbisGPL3 a bit more and the problem is, that this template has 4 (yes FOUR) css files and is loading some of these css files after the plugin css is loaded.

So there is no chance for a plugin css, since these values will be overwritten by his subsequent extra template css. Except plugin css values add !important.
Not necessarily. Everything depends on the specificity. As IDs have higher specificity than classes, we could solve some issues by requesting the template designer to not define rules for selectors containing any IDs. Plugins could always use selectors with IDs, and so would overwrite the template's rules.

PS: [1] Besides in this case the padding comes from core.css, and the border is the default property of the UA.
Last edited by cmb on Mon Apr 28, 2014 11:34 am, edited 1 time in total.
Reason: added PS
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: Arrggh! Don't overdesign templates

Post by svasti » Mon Apr 28, 2014 7:52 pm

cmb wrote:Plugins could always use selectors with IDs, and so would overwrite the template's rules.
I just tried using id instead of class and indeed, I don't have to use "!important" to overrule n6200tbisGPL3.
The remaining little problem is: If the plugin is called more than once on a page, several identical ids will exist. Ok, it'll still work, only it will not validate. Still better than using "!important".
cmb wrote:The shift is caused by padding + border in this case,
I see and just checked it: it's my mistake and Torsten is not to blame. :oops:
Just tried in core.css:

Code: Select all

#xh_mailform .text, .xh_mailform textarea {
    width: 100%;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
} 
and it works (even in IE8, in IE6 n6200tbisGPL3 doesn't work) and looks much better. So we may want to adjust this in 1.6.2 along with the rendering of the mail form on dark backgrounds.

So in the end, I guess I'll simply have to adjust my plugin.
mikey wrote:i guess mine have no problems that you describe
No problems :) .

Post Reply