Aligning check boxes vertically in IE using CSS

I just finished working on a project and while I was in the final testing phase, I realized that there were some check boxes in a form that were not displaying correctly in IE. I found a few answers on Google but, these did not fit to my CSS styling properties and I needed a quick fix without redoing a bunch of CSS.

So, I came up with a simple solution of adding a class to the check boxes.

Here is the my form. Just a list of the days of the week. I need them to display one below the other.

<form id=”stylized” name=”email_reminders” method=”post”>
<label for=”repeat_sunday”>Repeat:</label>
<input type=”checkbox” name=”repeat_sunday” value=”1″ />Sunday<br />

<label for=”repeat_monday”>&nbsp;</label>
<input type=”checkbox” name=”repeat_monday” value=”2″ />Monday<br />

<label for=”repeat_tuesday”>&nbsp;</label>
<input type=”checkbox” name=”repeat_tuesday” value=”3″ />Tuesday<br />

<label for=”repeat_wednesday”>&nbsp;</label>
<input type=”checkbox” name=”repeat_wednesday” value=”4″ />Wednesday<br />

<label for=”repeat_thursday”>&nbsp;</label>
<input type=”checkbox” name=”repeat_thursday” value=”5″ />Thursday<br />

<label for=”repeat_friday”>&nbsp;</label>
<input type=”checkbox” name=”repeat_friday” value=”6″  />Friday<br />

<label for=”repeat_saturday”>&nbsp;</label>
<input type=”checkbox” name=”repeat_saturday” value=”7″ />Saturday<br />

</form>

 

Continue reading

CSS vs Tables

The other day, my husband and I had an argument over CSS and Table based layouts for web pages. His point was that tables are more easier to predict and give a structure to the website where as with CSS it is rather difficult to achieve this. I think it is true to some extent. I used to design websites with tables before I learnt CSS. Now, I don’t think I would ever go back to table layouts entirely.  Here are some reasons why CSS based layouts are better.

File Size:

The file size with CSS based layouts is smaller which helps in faster loading of the site. Table based layouts have a lot more tags that result in a larger file size.  It has been found that CSS based layouts usually load 2-4 times faster than table based layouts.  It also takes up less bandwidth. Some hosting providers charge based on the amount of bandwidth used. So, using CSS layouts helps lower those costs especially if it is a large site. Patrick Burt has some good suggestions to reduce file sizes with CSS.

Cheaper and faster redesign:

In CSS based design, the content of the website is separated from its visual appearance. External style sheets Continue reading

CSS Tips and Tricks

When I am coding the web pages, I frequently run into problems with CSS rendering properly on Internet Explorer. So, the first place I go to for a solution is my best friend Google. Over the time, I have collected some CSS tips from the many forums and other websites and I save them for a quick reference. Here are some of them.

Margins in IE:

Margins are rendered differently in FF and IE – especially IE6. To correct the double margin showed by IE6 add the following:

display:inline

Margins for <ul> Tags:

<ul> tags have some standard margins. It determines how far the element wants to be from the elements above and below it.
If, the <ul> tag is rendering extra space above or below it, then add this to the style sheet:

ul{
Margin: 0em;
}

a:hover in IE:

I was surprised to learn that a:hover properties do not work properly in IE. When I was designing a menu for a client, I had a simple CSS for hovering over the links. This did not show up in IE. For the hover properties to work in IE add position:relative property.

#menu li a:hover{

border-bottom-color:#C30;

border-bottom-style:solid;

position:relative; /* This was added for the hover to work in IE */

}

Writing IE Specific hacks:

This is one of my favorites. If you wish to write a property specific for IE, just add ‘//’ in front of the property.

#menu li a{

color:#FFF;

text-decoration:none;

padding-left:10px; /*This will work for Firefox and other browsers*/

//padding-left:8px; /*This will work for IE*/.

padding-right:10px;

//padding-right:8px;

}

The most important thing to remember for this hack to work is that you have to write the general rule first and then the hack for IE. The first rule is seen by FF and other browsers. The next property is ignored all browsers except IE.

Feel free to add to the list and come back for some more CSS tips or better yet subscribe to my feed.