The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

How not to do CSS

Last post 10-07-2008 8:04 PM by ekolis. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 10-06-2008 12:02 PM

    • db2
    • Top 200 Contributor
    • Joined on 06-15-2006
    • Posts 169

    How not to do CSS

    I've been spending the past 20 minutes or so debugging some CSS quirks on a site that I've been asked to add a page to. This one pretty much tops off the stuff I've been seeing - it's part of the sitewide stylesheet:

    p {
        display:inline;
    }

    ...Yeah.

  • 10-06-2008 12:40 PM In reply to

    Re: How not to do CSS

    But is it better then center { text-align: left; }?

  • 10-06-2008 9:28 PM In reply to

    Re: How not to do CSS

    I worked on a website that was mostly clean, but had this style set globally:

    p {
    margin: 0;
    padding: 0;
    }

    And then every paragraph looked like this:

    <p>Lorem Ipsum<br /><br /></p>
  • 10-07-2008 4:37 AM In reply to

    Re: How not to do CSS

     Could be a pre-emptive bugfix.

    If you set the left margin of a floating element that is in a block container, IE6 will double the margin for no good reason.  Fortunatley doing something like

    p {

     display: inline;

    float: left;

    }

    Will magically fix the problem.  Maybe it's a catch all rule so that when p's are floated later in the CSS the margins will be fixed automatically?

  • 10-07-2008 5:54 AM In reply to

    • Bombe
    • Not Ranked
    • Joined on 12-14-2007
    • Hamburg, Germany
    • Posts 15

    Re: How not to do CSS

    I prefer:
    p {
      pudding: lots;
    }
    
  • 10-07-2008 10:01 AM In reply to

    Re: How not to do CSS

    The cake goes to this one, found in two different stylesheets for the same page:

    .Blue2 {
       color:#somebluetint;
    }

    .blue2 {
       color:#someotherbluetint;

    Which was rendered on a page without a DTD, and so IE7 and 6 proceeded to merge the two declarations as both their quirk-modes make CSS case-insensitive, when in fact it is case sensitive by spec (which is stupid in its own right).

    Count the wtfs.

     

    — Flurp.
  • 10-07-2008 4:36 PM In reply to

    Re: How not to do CSS

    My personal favorite:

    ul {

    list-style: none;

    }

     

  • 10-07-2008 5:07 PM In reply to

    • stratos
    • Top 50 Contributor
    • Joined on 09-06-2006
    • Zeeland, Netherlands
    • Posts 537

    Re: How not to do CSS

    savar:
    My personal favorite:

    ul {

    list-style: none;

    }

     

    Use it all the time, absolutely nothing wrong with that.

    My web-consulting company - My web development blog - "Show me a sane man and I will cure him for you." - C. G. Jung
  • 10-07-2008 6:37 PM In reply to

    • db2
    • Top 200 Contributor
    • Joined on 06-15-2006
    • Posts 169

    Re: How not to do CSS

    savar:

    My personal favorite:

    ul {

    list-style: none;

    }

     

    I'm pretty sure this site does that one too. It also sets the left margin of <ol> to 0, so you get numbers hanging off in the left margin.

  • 10-07-2008 8:04 PM In reply to

    Re: How not to do CSS

    Bombe:
    I prefer:

    p {
      pudding: lots;
    }
    

     

     No, no, no! You mean like this:

    p.porridge {

      spiciness: hot;

      temperature: cold;

      location: in-the-pot;

      age: 9d;

    }

Page 1 of 1 (10 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems