Forum Moderators: not2easy

Message Too Old, No Replies

Same Class twice

         

piskie

2:22 pm on Oct 15, 2006 (gmt 0)

10+ Year Member



Could somebody please clarify the reason for this type of class declaration being repeated in this way:

.databody2 { text-align:left; width:345px; margin:0px; padding:0px; }

AND

html>body .databody2 { text-align:left; width:345px; margin:0px; padding:0px; }

In the site in question, there are many if not most classes dual defined in this way.

penders

3:11 pm on Oct 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In short, as far as I can tell, I see no point in the 2nd declaration, since they are both the same!?

html>body .databody2 {....}

This effectively hides the declaration of .databody2 from IE5.5 and IE6 since these browsers do not support the child selector '>'. However, IE7 does support this AND it doesn't hide the declaration from IE5.

Besides, the rules for each are the same, so I see no reason behind this(?) Anyone?

bluesmandeluxe

4:20 pm on Oct 15, 2006 (gmt 0)

10+ Year Member



penders is right. They both have the same values, so to use it as an "IE hack" doesn't make sense. But, I'm sure the css also has other hacks related to those "duplicate" elements that further instruct IE how to behave.

Usually the "holly hack", "tan hack", the "commented backslash hack" and others are used in tandem with each other. I would imagine the css has elements with more than one width size, like:

#samename {
width: 100px;
padding: 10px;
border: 5px solid black;
margin: 10px;
}

/* A CSS comment before the hack to hide it from ie 5.x for mac \*/
* html #samename {
width: 130px;
}
/* Another CSS comment after the hack completes the commented backslash hack */

As I was typing these, I realized something ... I bet that the duplicates that start "html>body ...etc" are in a different section of the css and have other style elements that are actually different

piskie

11:59 pm on Oct 15, 2006 (gmt 0)

10+ Year Member



I have come to the conclusion that whoever did this was making provision for the hack to be implimented on every declaration should there be a browser issue. There are 19 such suplicate declarations in this external css file. There is just one where the html>body class declaration is different.

The straight class declaration is always followed by a Hack version, but only once out of twenty declarations is the Hack Version different. It appears to be an extravagent plan ahead method.

Wlauzon

12:03 am on Oct 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Of course a major problem might be that when IE7 comes out soon, most hacks will be broken.

bluesmandeluxe

4:56 pm on Oct 16, 2006 (gmt 0)

10+ Year Member



piskie, the person who coded the css, may have other pages that along with your page, use a different global css; he/she may have just put them in this css to offset the the values the global css used.

When in a hurry, and coding a lot of pages using a base template I made, I am guilty of doing this as a quick fix rather than properly renaming the id or class for one page.

**********************

>>Of course a major problem might be that when IE7 comes out soon, most hacks will be broken. <<

We all knew they were going to pull this one day. We just KNEW IT. It is amazing how they can actually be so obviously and intentionally contrary as to fix the BUG that let's the hack properly display standards css without even considering fixing the reason the hack is necessary.

For every good step they make towards the opne source, standards accepting community, they always take two giant backsteps.

They will not accept that they won the browser wars in 2000 until they are the only broswer in the world people use. Thankfully FF converted so many PC users.