SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot s21825's Avatar
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    162
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS is easy; bugs make it complicated (and unreliable?).

    I've been spending quite a bit of time lately working on my CSS skills. I've been working on creating a few designs that use 100% CSS for layout and style elements, and doing a lot of reading on CSS as well.

    On several occasions I've spent many hours fiddling and troubleshooting and RTFM (reading the manual) and various other attemped methods for figuring out where I've made a mistake in my CSS code ... only to discover that there is no "mistake" in my code, just a mistake in the browsers I'm testing on. I must admit I took some satifaction in getting the code right, but felt extreme frustration at all my "wasted" time.

    Sure, now I know about a few more "hacks" and I don't run into the same problems more than once or twice (if I'm tired or something), but I don't understand why there are so many issues with in implementation of CSS. It's not that tough to grasp, really, and I can see how it can be really slick a lot of the time. But to be considered an expert, you need to know all these hacks and bugs and who knows what else.

    When will CSS be mature enough to be able to use it and feel comfortable that your designs will not be plagued with bugs? What if I use a hack that gets fixed in a future browser release which messes up my pages? What will the next bugs be and where will I learn the hacks to deal with them? So many questions ...
    s21825

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by s21825
    When will CSS be mature enough to be able to use it and feel comfortable that your designs will not be plagued with bugs? What if I use a hack that gets fixed in a future browser release which messes up my pages? What will the next bugs be and where will I learn the hacks to deal with them? So many questions ...
    Stay away from hacks, at least until you know exactly how they work (and how CSS works in each browser). Looking for hacks is the first mistake that many a newbie to CSS makes and it creates a bad pattern. First try thinking about structuring your HTML or CSS differently to achieve the effect you want. For example, if floats are giving you a lot of trouble, try mimicking the same layout with absolute positioning instead. By applying a little creativity and thinking to your layout you'll probably find that most hacks aren't necessary.

  3. #3
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Apparently, it must not be all that easy to program a browser to do all those CSS things correctly. And, just think, you still have Javascript to learn, and then PHP.

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by 7stud
    Apparently, it must not be all that easy to program a browser to do all those CSS things correctly.
    Of course not. It gets worse when you graduate from CSS1 and move on to CSS2, which was a slightly flawed spec to begin with and has varying degrees of support in all browsers (example: IE/Windows supports very little of it, while Mozilla and Opera support most if not all of it).

  5. #5
    SitePoint Zealot s21825's Avatar
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    162
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I can see that hacks are a bad way to overcome some of the browser bugs, and I do agree that approaching the problem differently is a better solution. However, it is frustrating to have to redo a design that "should" work fine, only to encounter a bug in a browser and then you have to start again.

    Does JavaScript have browser specific bugs? Or is it just CSS? If so, why?

    Don't get me wrong, I think CSS is great.
    s21825

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by s21825
    Yeah, I can see that hacks are a bad way to overcome some of the browser bugs, and I do agree that approaching the problem differently is a better solution. However, it is frustrating to have to redo a design that "should" work fine, only to encounter a bug in a browser and then you have to start again.
    I've been there before and I feel your pain. Trust me, the more CSS layouts you do, the easier it gets. For one, you'll learn what kind of layouts to avoid, and you'll become more proficient with CSS in general so the chances of getting it right the first time improve with each successive layout you try.
    Quote Originally Posted by s21825
    Does JavaScript have browser specific bugs? Or is it just CSS? If so, why?

    Don't get me wrong, I think CSS is great.
    Yeah Javascript has browser-specific bugs, in addition to varying levels of support with each browser. You won't notice it on the simpler stuff (remember that JS has been around longer than CSS so browser developers have had more time to agree on/copy features), but when you try to do something extremely advanced it will come back and bite you. Just do the best with what you've got today .

  7. #7
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,352
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    I hope they don't fix all those bugs then I'll have nothing to do

    I also find it frustrating that css has quirky browser support and this does make it difficult for people starting out on css to grasp it. They learn a rule from a book only to find that it doesn't work or doesn't work the same in various browsers.

    However I don't think tables are much better (and were certainly worse at the start) and you only have to look at js browser sniffer script to see how many different slants of js need to be accounted for.

    I agree with vinnie that if you can change your design to avoid a hack then thats the best way to go. However I have endless struggles with peoples layouts on the forums where they say in "mozilla the page is 1 pixel lower down , how can I fix it ?". I usually say well it looks ok to me but end up offering a hack to keep them happy.

    However I don't think using a hack is bad when it accomplishes the goal and if the only difference if the hack was to fail in the future is that the page would display as it would have done already.

    Targeting browsers such as ie5 and ie5.5. with hacks is completely safe because they are never going to change. You just have to make sure you don't compromise anyone else.

    However there are so many hacks about now that when I look at some peoples code I haven't got a clue as to what they were trying to do and many times it could be done without said hack anyway.

    Some purists would say don't use any hacks but then avoiding using hacks by manipulating the html could also be seen as a worse crime.

    Css isn't difficult as you say and once you know the main hacks its more or less plain sailing. The main problems I hear time and again can boil down to just a few problems and if you learn them first then life gets easier.

    Broken box model
    position:relative
    3 pixel jog
    height:1%

    Knowing how to use the above can fix 90% of the problems on the forums .

    Paul


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
  •