of CSS Layout
Sh Posit
ning Prop
erties At-A
-Glag nce Guide
ating Sexy Stylesheets Dating
Trenton is crazy about Web usability and accessibility – so crazy that he went and started his own View all articles by Trenton Moss...
CSS can be complex, and as each new browser version is released, you may well find yourself struggling to keep up with the latest tips and hacks. But those tips and hacks will save your sanity! Here, I've put together the ten tips that I find most helpful, to save you the hassle of scrounging around the Web for solutions when time is tight.
Nearly all HTML elements are either block or inline elements. The characteristics of block elements include:
Examples of block elements include <div>, <p>, <h1>, <form>, <ul> and <li>. The characteristics of inline elements, on the other hand, are the opposite of block elements:
Examples of inline elements include <span>, <a>, <label>, <input>, <img>, <strong> and <em>.
To change an element's status, you can use display: inline or display: block. But what's the point of changing an element from being block to inline, or vice-versa? Well, at first it may seem like you might hardly ever use this trick, but in actual fact, this is a very powerful technique, which you can use whenever you want to:
The box model hack is used to fix a rendering problem in pre-IE 6 browsers on PC, whereby the border and padding are included in, rather than added onto, the width of an element. A number of CSS-based solutions have been put forward to remedy this; here's another one that I really like:
padding: 2em;
border: 1em solid green;
width: 20em;
width/**/:/**/ 14em;
The first width command is read by all browsers; the second by all browsers except IE5.x on PC. Because the second command comes second, it takes precedence over the first: any command that comes second will always override a preceding command. So, how does all this work?
By placing empty comment tags (/**/) before the colons, we instruct IE5.0 to ignore the command. Likewise, if we place empty comment tags after the colon, IE5.5 will ignore the command. Using these two rules in conjunction with each other, we can hide the command from all of IE5.x browsers.
A very handy CSS command that exists is the min-width command, whereby you can specify a minimum width for any element. This can be particularly useful for specifying a minimum width for a page.
Unfortunately, IE doesn't understand this command, so we'll need to come up with a new way of making this functionality work in this browser. First, we'll insert a <div> under the <body> tag, as we can't assign a minimum width to the <body>:
<body>
<div class="container">
Next, we create our CSS commands, to create a minimum width of 600px:
#container
{}
The first command is the regular minimum width command; the second is a short JavaScript command that only IE understands. Do note, though, that this command will cause your CSS document to become invalid; you may prefer to insert it into the head of each HTML document to get around this.
You might also want to combine this minimum width with a maximum width:
#container
{}
IE has a rather strange way of doing things. It doesn't understand the min-width and min-height commands, but instead interprets width and height as min-width and min-height -- go figure!
This can cause problems, because we may need boxes to be resizable should we need to fit more text into them, or should the user resize the text. If we use only the width and height commands on a box, non-IE browsers won't allow the box to resize. If we only use the min-width and min-height commands, though, we can't control the width or height in IE!
This can be especially problematic when using background images. If you're using a background image that's 80px wide and 35px high, you'll want to make sure that the default size for a box using this image is exactly 80 x 35px. However, if users resize the text, the box size will need to expand gracefully.
To resolve this problem, you can use the following code for a box with class="box":
.box
{}
html>body .box
{}
All browsers will read through the first CSS rule, but IE will ignore the second rule because it makes use of the child selector command. Non-IE browsers will read through the second one, which will override the values from the first rule, because this CSS rule is more specific, and CSS rules that are more specific always override those that are less specific.
One of the lesser known, but really useful CSS commands is the text-transform
mCunt You Loveresults Dating Tips Sexy My Top Te CSS Tricks [CSS Tutorials Porn Cunt You Loveresults Dating Tips Sexym v Web
zCunt You Loveresults Dating Tips Sexy My Top Te CSS Tricks [CSS Tutorials Porn Cunt You Loveresults Dating Tips Sexyx y Russian Service Web