CSS is a wonderful, and life shortening thing. When I initially set out to learn it over 3 years ago, I only used it to format fonts and remove the underline from links. This was because no 2 browsers interpreted CSS the same, which made a 100% CSS design all but unattainable.
Now, thanks to everyone but Microsoft’s effort to move towards a standard, CSS has moved to the forefront and become, in my opinion, the only way to design a website. The web has outgrown HTML and is ready to graduate to adding more design, with less markup.
Here are a few CSS tidbits that I wish I had known before I spent hours scouring the Internet to find the answer myself. I hope they’ll help you save the precious years of your life… that I’ve lost.
I have yet to find a website better at explaining how to accomplish horizontal centering with CSS than BlueRobot. However, the basic idea is to set the left and right margins for the respective CSS object to “auto”. This works in browsers with CSS2 support, but not in IE5 (thank you Microsoft).
However, if you exploit IE5s incorrect application of the “text-align” attribute, you can make your horizontal dreams come true (for CSS anyway).
For exact details, see BlueRobot’s article.
Working with Forms
When I was a PHP programmer, I would always wrestle with the <form> element. Anytime I wanted to place a search box, or some other element, into a design, it would explode in IE (thank you… again… Microsoft).
Thankfully, there is a simple fix for this annoyance. Just set the margin attribute for you <form> element to zero, like so:
By doing the same thing to your <input> element, you can remove their beveled edges.
As you can see, my website has a 2-column design. The markup to do this is pretty straightforward:
The above creates a page with a header, 2 columns under it, followed by a footer. But there is one problem. The height of the left or right column depends on the amount of content in them. If you want both columns to be the same height with dynamic content, there is no way to know how to set the height attribute. And no… height: 100% doesn’t work.
But fear not, there is a solution.
By using a background image applied to the “content” div:
You can let the background image pick up where either column falls short. So no matter which column ends first, they will both appear to have equal heights.
- The only way for my posts to get better is to get your opinion! So help me out, and rate this one! Thanks!
We all realize that every photo found between the covers of our favorite magazines is digitally enhanced. Blemishes are remo...
I'm on a home movie digitization kick. I've just finished converting 3 very aged VHS movies to DVD for Cassandra's family. ...
And to think, YESTERDAY should have been the first day for BrianShoff.com. But, during some server housecleaning, I managed ...