Equal height columns in CSS

April 21st, 2008 royuen Posted in CSS No Comments »

To achieve equal height columns using <table> in html is very easy, it is directly supported. However in CSS world, how can we create 2 equal height columns using <div> tag and applying CSS to decorate?

Let’s create a HTML file with a container and 2 columns:

<html>
<head>
<style type="text/css">
.decorate { float: left; background: #000; color: #fff; width: 100px; margin-right: 10px;}
</style>
</head>
<body>
<div class="container">
<div class="container">
<div class="column decorate">
dgd digjifjg iodjgiof fdu ghfd ghofh gidfhg ihfg ihdfi
</div>
<div class="column decorate">
dgd digjifjg iodjgiof
</div>
</div>
</div>
</body>
</html>

In the above html, it results in following output:

Now we fix it by applying “container” and “column” class in CSS:

.container { float: left; overflow: hidden; }
.container .column { margin-bottom: -5000px; padding-bottom: 5000px; }

The page will result in 2 equal height columns

It works in IE 6, 7, Firefox and Safari.

AddThis Social Bookmark Button

Create rounded corner in CSS without using images

April 4th, 2008 royuen Posted in CSS No Comments »

The most straight forward way to create rounded corner would be using images. You have to generate multiple rounded corner images and you also need to ensure if the images match the background colour. Besides you have to make sure that it wouldn’t break the website layout.

Instead we may use some tricks and purely do it in CSS, without using any image. Spiffy Corner already did a good job for us, you can select the foreground colour and background colour and generate your rounded box immediately.

Technorati Tags: , ,

AddThis Social Bookmark Button