Css Hacks unveiled

Discussion in 'CSS' started by prithwirajsaha83, May 6, 2010.

  1. #1
    Now a days a lot of browsers are present starting from IE (the most buggy one) to chrome,firefox(gecko browsers) ,opera safari and lots of other one.

    So during designing a page it does sometime becomes nessecary to load different css conditionally depending upon the browser because of the difference that browsers parse some styles differently. for example IE box model and many others...

    format of conditional css

    <!--[if condition]> HTML <![endif]-->

    the previous example shows how to conditionaly include a css file. so if we have multiple css files targeted for each browsers we can load them conditionaly ..........

    There are also inline hacks


    such as
    !
    !important
    @import “non-ie.css” all;

    etc......


    But some Hacks you shouldnot use
    like

    _property: value and -property: value
    body:empty
    >body
    or many more ....

    To read more

    http://www . knowledge-transfers . com/it/inline-css-hacks
    http://www . knowledge-transfers . com/it/css-hacks-which-should-be-avoided
    http://www . knowledge-transfers . com/it/css-hacksconditional-css
     
    prithwirajsaha83, May 6, 2010 IP
  2. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #2
    Most of this post is pure garbage and wrong. I would not trust anything from this guy.
     
    drhowarddrfine, May 6, 2010 IP
  3. prithwirajsaha83

    prithwirajsaha83 Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Can you please point out which one is wrong?

    Tried those techniques?
     
    prithwirajsaha83, May 6, 2010 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #4
    1) The language used in the post screams spam.

    2) !important and @import are not hacks, they are parts of the CSS specification.

    3) conditional comments do not work in your CSS, though they can be used in the HTML to wrap a CSS embed - personally I consider resorting to sending separate stylesheets to each browser to be an asenine approach when 99% of the problems with IE can be fixed by tripping haslayout, using display:inline on floats to avoid margin doubling and learning how to comment properly (improperly placed comments can trip IE rendering bugs).

    The only 'true hacks' one really needs to know on 99% of layouts is "* html" to wrap behaviors and expressions to implement the bits of CSS 2.1 missing from IE6, and zoom:1; to trip haslayout. That's it. If you don't need to fake the min-xxx max-xxx properties or implement hovers on any element, there's little reason to be needing that one either.

    Of course that the site you linked to blows 50k of markup on 8k of plaintext doesn't exactly inspire confidence.
     
    deathshadow, May 6, 2010 IP
  5. AtSeaDesign

    AtSeaDesign Active Member

    Messages:
    172
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    93
    #5
    haha. Nice. It never ceases to amaze me when people post blatantly wrong information.

    If you know how to code correctly there should be maybe 1 to 2 conditional statements for IE. If you are using a completely bloated style sheet for IE, then you need to brush up on your skills.
     
    AtSeaDesign, May 6, 2010 IP
  6. prithwirajsaha83

    prithwirajsaha83 Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    People
    !important is a part of css specification but
    Internet Explorer 5 and 6 ignore the !important declaration if the same property is declared twice in the same block of styles.
    p {margin-left: 5px !important; margin-left:10px}
    so can be used as a hack


    conditional comments are used to embed conditionally css in the html ... which was written as "load different css conditionally" ...

    and about only true hacks person really needs to know... one can never predict the scenario which a person encounters and has to use which techniques. So this is a list of all of them . let the users choose.. and others can give a opinion or suggestion ...

    Now about the pages referred that site has just started up.. posts are nice.. design and other related works will be improving over time.
     
    prithwirajsaha83, May 6, 2010 IP