[Typo3-dev] templavoila + conditional comments

Christopher tombedlam at yahoo.com
Wed Nov 3 16:41:54 CET 2004


--- Chi Hoang <hoang at planb-media.de> wrote:

> Christopher wrote:
> > My first question would be 'what are you trying to achieve?' I rely
> > very heavily on css in my pages but I've never needed to use the IE
> > conditional comments. If you let me know what effect you want, I
> may be
> > able to suggest another option...
> 
> I have trouble with the Boxmodel of IE and Netscape/Mozilla/Firefox
> in 
> Quirksmode! Do you have any hints?
> 
> Greets,
> 
> Chi

Well, you're right, the IE conditionals *are* useful for that. But you
can exploit the so-called 'tan-hack' ([1], [2]) and it's variants for
IE-only styles. 

Here's the variant that I like to use:


/* The overall width of this object will be 140px */
.width-demo /* for standards-compliant browsers */
{ 
  width:100px; /* Content area = 100px */
  padding:0 10px; /* ...plus 10px padding on each side */
  margin:0 10px;  /* ...plus 10px margin on each side */
}

* html .width-demo  /* this selector recognized by IE only */
{
  \width:140px;   /* total width (only for IE5.x/Win) */
  w\idth:100px;  /* content width (for other IE [i.e. IE6]) */
} 


...It looks a bit messy, but it's mostly 'cause of all the comments I
put in it. It's important, if you're going to try to correct the broken
box to make *sure* you're in standards mode (e.g. use the full doctype
and do not use the xml prologue which will send IE into quirks mode
again regardless of doctype...)

By the way, as a last-resort solution, you can use
'page.disableAllHeaderCode' in your template - though you will have to
build the whole header as a cObject [3].

-Christopher


[1] http://www.google.com/search?hl=en&lr=&q=%22tan+hack%22

[2]
http://www.google.com/search?q=site%3Awebmasterworld.com+%2B+%22tan+hack%22

[3] http://typo3.org/documentation/document-library/doc_core_tsref/quot_CONFIG_quot/


		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 





More information about the TYPO3-dev mailing list