Jump to content

how to re-write global modification?


ridz16

Recommended Posts

Better to use classes for that than redefine the whole type:div.menu, p.menu, ul.menu, li.menu {margin:0; padding:0;}This changes the values only for items tagged like this: <div class="menu">. All other div, p, ul, and li elements are unaffected. So "later on down the code" (or anywhere, really) an <li> would still have its default values. Even easier:.zero {margin:0; padding:0;}This can be applied to any element, so for instance I can write:<div class="zero"></div>.zero can also be applied in combination. Imagine I have a div class (call it "bob") that defines color, border, other stuff. For just one instance of it, I can eliminate its margin and padding like this:<div class="bob zero">Except for very short, simple pages, good designers rarely redefine a whole type. They define classes instead. The exception is the body element, since there is only one body.

Link to comment
Share on other sites

DD, google eric meyers reset css.The is a movement afoot to use a "rest css" file which eliminated all the Browser default settings for padding, margin, etc to eliminate the differences found in Browsers which can create difficulties in obtaining cross-browser results. IE and Firefox, for example, use padding and margins differently on UL/LI's. The rest css file eliminates all of the padding and margins for them. It then becomes the responsibility of the page Author to assign the margin and padding for these elements. Whether the Author defines page/site wide UL/LI settings, or defines them according to an ID or class is immaterial in the reset css. It is actually more work for the Author to "reset" and then "define" all of the elements on the page, but it gives full control for the page to the CSS file in all browsers, thereby eliminating the cross-browser differences.

Link to comment
Share on other sites

Actually, I can see that very well. There've been several threads recently on the differences in <p> defaults, just for an example. I don't think that's where OP needs to enter the conversation, however. But thanks for pointing it out. I do far less reading than I should on all this. Much more hands-on, which has it's advantages, but too often I reinvent the wheel or just plain miss something.

Link to comment
Share on other sites

Oh! That Eric Meyer. I got the basics for CSS menus from him (did everyone?) but for some reason never bothered to check out the whole site. Yes, the reset thing makes perfect sense. I never thought of it so explicitly before because (since forever) I've automatically set things like padding and margins and colors and font family whether I needed to or not. The one that always burns me is <p>! So lately I've been resetting that too, but without thinking of it in that way. Only now I have a name for it.This is something we regulars ought to get worked up about on this board. The way we all pounce on TABLES or FRAMES or teach people how to center stuff, we all say the same things? Even if it's just to say, "Zero your margins and padding and go from there." It would eliminate a lot of basic problems. "Why do I have a gap here?" Reset and start over. I basically said that to someone this morning.But if we all said it the same way . . .Yeah. Default values are totally 1998. #### 'em.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...