Is there a business reason for striving for pure CSS layout?

后端 未结 21 722
情深已故
情深已故 2021-02-02 08:30

It seems like every time I try to create a pure CSS layout it takes me much longer than if I\'d use a table or two. Getting three columns to be equal lengths with different amou

相关标签:
21条回答
  • 2021-02-02 09:04

    *I would let him use whatever his WYSIWYG Editor spits out
    I just threw-up a little...
    *ahh hello? You don't think the graphic designer is writing the CSS by hand do you?

    Funnily enough I have worked with a few designers and the best among them do hand-tweak their css. The guy I am thinking of actually does all of his design work as an XHTML file with a couple of CSS files and creates graphical elements on the fly as he needs them. He uses Dreamweaver but only really as a navigation tool. (I learned a lot from that guy)

    Once you've made an investment to learn purely CSS-based design and have had a little experience (found out where IE sucks [to be fair it's getting better]) it ends up being faster I've found. I worked on Content Management Systems and the application rarely had to change for the designers to come up with a radically different look.

    0 讨论(0)
  • 2021-02-02 09:07

    doing a complete revamp of a 15 page web site just by updating 1 file is heaven.

    This is true. Unfortunately, having one CSS file used by 15,000 complex and widely differing pages is your worst nightmare come true. Change something - did it break a thousand pages? Who knows?

    CSS is a double-edged sword on big sites like ours.

    0 讨论(0)
  • 2021-02-02 09:11

    I don't think there is a business reason at all. Technical reason, maybe, even so, barely - it is a huge timesuck the world over, and then you look at it in IE and break down and weep.

    0 讨论(0)
  • 2021-02-02 09:12

    Like a lot of things, it's a good idea that often gets carried too far. I like a div+css driven layout because it's usually quite easy to change the appearance, even drastically, just through the stylesheet. It's also nice to be friendly to lower-level browsers, screen readers, etc. But like most decisions in programming, the purpose of the site and the cost of development should be considered in making a decision. Neither side is the right way to go 100% of the time.

    BTW, I think everyone agrees that tables should be used for tabular data.

    0 讨论(0)
  • 2021-02-02 09:15

    I'm of the thought that CSS layout with as few tables as possible is cleaner and better, but I agree that sometimes you just gotta use a table.

    Business-wise, it's generally "what's going to get it done the fastest and most reliable way." In my experience, using a few tables generally falls into that category.

    I have found that a very effective way to mitigate cross-browser differences in CSS rendering is to use the "strict" doctype at the top of your page:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    

    Also, for the dreaded IE6 CSS issues, you can use this hack:

    .someClass {
        background-color:black; /*this is for most browsers*/
        _background-color:white; /*this is for IE6 only - all others will ignore it*/
    }
    
    0 讨论(0)
  • 2021-02-02 09:16

    Since this is stackoverflow, I'll give you my programmer's answer

    semantics 101

    First take a look at this code and think about what's wrong here...

    class car {
        int wheels = 4;
        string engine;
    }
    
    car mybike = new car();
    mybike.wheels = 2;
    mybike.engine = null;
    

    The problem, of course, is that a bike is not a car. The car class is an inappropriate class for the bike instance. The code is error-free, but is semantically incorrect. It reflects poorly on the programmer.

    semantics 102

    Now apply this to document markup. If your document needs to present tabular data, then the appropriate tag would be <table>. If you place navigation into a table however, then you're misusing the intended purpose of the <table> element. In the second case, you're not presenting tabular data -- you're (mis)using the <table> element to achieve a presentational goal.

    conclusion

    Whom does this hurt? No one. Who benefits if you use semantic markup? You -- and your professional reputation. Now go and do the right thing.

    0 讨论(0)
提交回复
热议问题