6 ms·
Take the idea, but don't try to learn HTML and CSS from this post. This is bad: <div class='header'>Basic Information</div> Don't you ever use anything like
by rimantas 17y ago
Take the idea, but don't try to learn HTML and CSS from this post.
This is bad:
<div class='header'>Basic Information</div>
Don't you ever use anything like this—HTML has a nice set of dedicated header elements.
There are the cases when you need to wrap your ULs into DIVs, but most of the time
<div id='main_menu'>
<ul class=menu'>
Can be replaced by simple <ul id="main_menu">
Some CSS tips:
a) don't specify units for zero values. 0px is the same as 0em is the same as 0pt—you get the idea. So plain 0, not 0px.
b) properties that accept four values (like margin or padding) allow some shortcuts: if the only one value is specified, it is applied to all sides. If there are two values, the first is used for the top and bottom, the second for the right and left. If there are three values, the first is for the top, the second for the right and left, the third for the bottom. This often comes handy.
E.g. "margin:15px 0px 10px 0px;" can be written as "margin: 15px 0 10px;"
The easy way to remember what is the order of the four values is mnemonic TRouBLe: Top, Right, Bottom, Left.
c) If your color values look like #xxyyzz you can use short form #xyz. So #999 instead of #999999, #abc instead of #aabbcc.
- Groxx 17y agohah, "TRouBLe", haven't heard that one. That's kinda useful... most mnemonics I've seen typically mean I have to remember more rather than less. Heck, about the only other one I've found useful is "roygbiv", and that's more about being pronounceable. Any particular reason for not specifying value types on zero? As in, is there a difference in how it's interpreted? Or is it just for code style?
- pavel_lishin 17y agoI always just thought of it as a clock. Start at noon, and go.
- RyanMcGreal 17y agoI've always thought of it in terms of a compass: north east south west.
- Groxx 17y agoI've done both this and the compass too. "TRouBLe" just feels like it's in real competition in my brain for prime spot, instead of a clock (compass died out a while ago).