[TYPO3-RTE] Add more as one CSS Class to an Link

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Oct 13 12:12:28 CEST 2008


Hi,

I was just about to write this also. IE has never had a problem with
multiple classes in the XHTML code and to reference each one of them
individually in CSS.

It has just problems with selectors that reference to more than one
class: this doesn't work in CSS with IE:

DIV.class1.class2 { border: 1px solid red; }

which means apply if both classes are set. IE will tread that as:

DIV.class2 { border: 1px solid red; }

Which is why you usually maintain a "one semantic per classname" to
avoid having to use multiple class selector in CSS.

DIV.email { styles for all emails }
DIV.email-with-icon { additional styles for all emails with icon }

And then make sure you always set "email email-with-icon" together, if
you need an email with icon.

Cheers,
Ernesto

Joerg Wagner wrote: on 12.10.2008 01:14:
> I use multiple classes in one class attribute very often and I never had
> a problem with IE6 or 7 ignoring one of the classes.
> Have a look at the html code of  https://www.learnmusic-online.com/ ...
> You will find class attributes like this one all over the place:
>   <div class="x310 y320 bottomMargin bgPos_MitteMitte">
> They work flawlessly in IE6 and 7. If only one attribute would be
> ignored the whole page layout would go havok because all the tiles on
> the page are floats and the class attributes control their sizes and
> positions.
> 
> Cheers,
> Jörg.
> 
> 
> Christopher schrieb:
>> "Stefano Kowalke" <blueduck at gmx.net> schrieb im Newsbeitrag
>> news:mailman.1.1223730363.30426.typo3-project-rte at lists.netfielders.de...
>>> Christopher wrote:
>>>
>>>> Hi Stefano,
>>>>
>>>> having a look at the html-references it is possible to have several
>>>> classes at one tag, but you must know that IE 6 and 7 do not respect
>>>> them
>>>> correctly: As far as I read they only use the last class, not taking
>>>> into
>>>> account that there were some others before.
>>>>
>>>> That is why I always avoid having multiple clases, but use one clear
>>>> classname, e.g. class="email" (for link without icon) or
>>>> "email_with_icon"
>>>> (for link with icon).
>>>>
>>> i think we should not orient us at the bad behavior of an IE6 or IE7.
>>> To have multiple classes in one attribute is usual XHTML standard.
>>
>> Right, I just wanted to add this, just in case someone wondered why it
>> would not work correctly with these browsers. ;-)
>>
>> Christopher
>>


More information about the TYPO3-project-rte mailing list