CSS Float
float is not a positioning property in CSS —the only position properties in CSS are absolute, relative, fixed, and static—however, when you combine widths, margins, and floats, you have CSS properties at your command that are often more reliable in terms of layouts than any of the available position properties.
I was reading about CSS and was trying to create a layout using float. There is a great article that explains CSS float in detail.
Advantages of using CSS
CSS is becoming very popular these days and creating layouts using CSS is becoming a standard. The advantages of using CSS are:
- Easier to make site-wide changes. It is easier to maintain one CSS file rather than modifying each page.
- Making changes to layout does not affect the HTML or server side code.
- As browsers cache the style sheet page, the page loading becomes fast. The styles classes are not loaded from server each time, if different pages of same site use the same CSS, the cache is read.
- As property with value is defined at a common style class and we use the same class at different locations, so we use less code. Less code means less bandwidth consumption and easy to maintain the content.
- Layout and position of navigation can be completely consistent across a site.
How to apply border to tables in Internet Explorer
IE does not acknowledge borders for the <tr> element. The only way to allow it is to trick IE by creating an illusion that the <td> element is continuous in a given <tr>.
To do that set the value of border-collapse property to collapse for the given table.
eg.
table { border-collapse:collapse; }
td { border-bottom:2px solid #000; }
