[TYPO3-dev] Typo3 Icon Contribution

Christopher bedlamhotel at gmail.com
Mon Aug 21 16:55:50 CEST 2006


Hello,

On 8/21/06, Martin Kutschker <Martin.Kutschker at n0spam-blackbox.net> wrote:
> Christopher schrieb:
> > On 8/18/06, Martin Kutschker <Martin.Kutschker at n0spam-blackbox.net> wrote:
> >
> >> Michael Scharkow schrieb:
> >> > Martin Kutschker schrieb:
> >> >
> >>
> > <snip>
> >
> >>
> >> And the idea to set a style for TAG without bindign
> >> to a class still makes me shudder...
> >
> >
> > Sorry if this seems like a stupid question--I have /not/ dug into the
> > skinning API or looked very deeply into the new skin.  But why would
> > styling tags directly be a bad idea?
>
> If you have somethig like INPUT {...} you affect *all* generated HTML code
> in the *whole* BE. This will a) be a trouble for extensions that don*'t
> expects such a behaviour and b) makes troubles anyway as INPUT tags can be
> text fields, check boxes and radio buttons. Many X-browser problems in the
> new skin stem from that problematic definition. Yes, there is a very
> unfortunate INPUT declaring in the skin.
>
> To be precise. The skin tries to add some height into TCA form sections.
> The BE has no classes for the TDs. So the skin added paddings or margins (I
> don't rememver) to all INPUT tags. This is ugly in many situatiosn and
> completele destroys the alignment of checkboxes.


Well, a global margin on input would be sure to cause problems. But
this problem does NOT indicate that usual best practices for writing
CSS should be ignored. If anything it indicates that the  crufty HTML
in the BE is in very, very serious need of improvement. Since we're
talking about fixing the BE in the first place, let's fix the actual
problem rather than making things _worse_ by bloating the CSS in order
to fix deficiencies in the markup.

As Joey already suggested, it would be smart to give an id or class
attribute to all the major containers on the page--that way descendent
selectors can be used to target most elements:

.TCE_form table tr td ul li input { /* Whatever */ }

Besides: form controls are a special case. They're almost unique among
HTML elements in that the type attribute can radically change them to
(effectively) completely different elements.

But in any case, you can use attribute selectors to target the
differnt types of input elements for every modern browser on earth
(including, supposedly, the upcoming release of IE7) except IE6, and
there you can use expressions:

/* For most browsers: */
input[type=checkbox] { margin:0; }

/* For IE 5 and 6: */
input { margin:expression(this.type=="checkbox"? '0' : '1em;'); }

The best way to deal with IE's many problems is to remove IE-only
styles to a separate stylesheet using conditional comments.


>  > Styling the BE would have different requirements from the FE, and must
>  > use many more classes, but even in the BE there must be many times
>  > when it makes sense to set a default style--by styling the tag--and
>  > afterwards /vary/ that style as needed with classes?
>
> For some tags perhaps. But it must be an unintrusive default (eg font
> size). Adding margins to INPUT elements was a very badd idea.
>
> The problem is that the current BE lacks some classes. This must be changed
> for 4.0.2.

For 4.0.2 maybe--though I would still suggest exploring the
possibilities with the CSS--in the long term, the BE's HTML _must_ be
fixed.


-Christopher




More information about the TYPO3-dev mailing list