SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    London
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Css _right question

    Hello All

    I came across this css hack :

    _right:-120px;


    Can anyone please tell me what this does?

    cheers
    g

  2. #2
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    http://wellstyled.com/css-underscore-hack.html

    You would need to test it and see which versions of IE are effected.. i'm not sure.

    It's definitely not encouraged so I would stick to the IE conditionals and/or the * html hack

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    London
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up thanks

    thanks markbrown4, will check out the link

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,344
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Its an ugly hack for ie6 and under so avoid it like the plague

    Use conditional comments or the star selector hack instead so that the hacks are at least separated from the style block and other browsers aren't bothered with them.

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    London
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up cheers

    thanks Paul O'B

    I need to start looking into CSS hacks a bit more, IE seems always to be the one with an issue though.


    g

  6. #6
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hacking for IE is hardly necessary, really. What's actually required is a change in (X)HTML coding habits. I'm not calling you out (I didn't even look at your code, I'm just typing in general terms for everyone else's benefit - well, everyone save for Paul O' Brien anyway ), but using a minimalist (X)HTML document structure will go a long way towards eliminating the need for IE 5.01, IE 5.5 and IE 6 hacks. There are a few times when they will be necessary, however. When those times come, I tend to rely on the box model hack (very rarely - in fact, in the past year I've only used it once, and that was for a pure 3 column CSS layout I was developing to replace my then current one), the star selector hack, and conditional comments.

    It just involves some trial and error, and patience. Lots of patience. Experiment with some non-paying work (I like to mess around with CSS based layouts a lot, which is what helps me improve my skills) in your spare time and see what you can come up with.

  7. #7
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Paul O'B View Post
    Its an ugly hack for ie6 and under so avoid it like the plague
    If it works for IE6 and below why is it so nasty?
    It's a few less characters than the other methods

    "...and other browsers aren't bothered with them." - But aren't the other browsers similarly bothered with the presence of "* html xxx" throughout the style block? Or are you suggesting that the best method is to completely seperate the IE specific styles from the other browsers? That seems logical enough to me.

  8. #8
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,344
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    If it works for IE6 and below why is it so nasty?
    It's a few less characters than the other methods
    Well first and foremost the validator flags it as invalid which is a good enough reason there. Although some argue that the validator is wrong as the underscore is a valid character. However underscores should not be used for properties according to the specs so that's why it gets flagged as an error.

    Secondly with all these other hacks you have to be sure that it doesn't affect other browsers and there are so many hacks about its not worth the effort remembering them all and to who they apply.

    For instance the voice family hack is still being used yet very few people realise that this causes ie5 to jump not only the next property but the next whole style block following the hack and usually with disastrous results.

    On the other hand * html is so tried and tested an known by all including MS that we can be sure its never going to give us problems again and can be safely used to target ie6 and under in the sure knowledge that other browsers will ignore the whole block. Its also easy to remember and easy to apply to a whole style block unlike other fixes.

    It also makes sense to me to keep your hacks out of the original style blocks and when in the future you want to tidy up you can just search for * html and there you are. It also looks so much neater and easier to debug.

    Conditional comments are also good but as I said before there should never be more than a few box model hacks and odd fixes in the ie only file otherwise maintenance becomes difficult.

    As Dan said if you code correctly you can keep hacks to a minimum and only use a hack to fix a known bug or display problem and not just to make up for something that went wrong somewhere else


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •