<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>How to attach a full width footer to an absolute width wrapper</title> <style type="text/css"> html, body { height: 100%; } * { margin: 0; padding: 0; } .main { height: 0 auto; min-height: 100%; } .footer { position: absolute; bottom: 0; /*To anchor with bottom border of container*/ left: 0; /*To anchor with left border of container*/ right: 0; /*To anchor with right border of container*/ background: BurlyWood; } </style> </head> <body> <div class="main"> <div class="top">Top</div> <div class="content">Somecontent</div> <div class="footer">Footer Content With absolute position</div> </div> </body> </html>and you are done You can apply this solution to any absolute position object
world wide web development problems asp net php html xhtml css javascript jquery w3dproblems
Thursday, November 25, 2010
How to attach a full width footer to an absolute width wrapper
When you absolute position any object using CSS, the width: 100% may not work correctly in any browser. To workaround this problem we use the anchor solution. For example you want a layout in which the footer should expand to 100% width use the following CSS
Sunday, November 14, 2010
IIS cannot be started. Another web site may be using the same port
Sometimes when you try to start a stopped website, you receive an error message telling you
"IIS cannot be started. Another web site may be using the same port"This problem occurs when this websites http(or other protocol) have been declared with no value or duplicate value. To solve this problem just
Right click on the web site and then click on "Edit Bindings...". If there are two binding to any port. Remove the one where the IP Address is empty.
Friday, November 12, 2010
Create counter using CSS and its benefits
CSS counters are an implementation of Automatic counters and numbering in CSS 2.1. The value of a counter is manipulated through the use of counter-reset and counter-increment and is displayed on a page using the counter() or counters() function of the content property.
To use a CSS counter, it must first be reset to a value, 0 by default. To add the value of a counter to an element, use the counter() function.
Code
Benefits
If you are using programmatic counters created using php or asp.net, and you apply table sorters the counter column also gets sorted. In some cases it does not matter but if it does then you can use the css counter because table sorters have no effect on them.
To use a CSS counter, it must first be reset to a value, 0 by default. To add the value of a counter to an element, use the counter() function.
<style type="text/css">tbody tr { counter-increment: rownum; } tbody { counter-reset: rownum; } table.name td.row:before { content: counter(rownum); }
</style>This code will apply counter to the table(class='name') and column (class='row')
Code
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Testing counters</title> <style type="text/css"> tbody tr { counter-increment: rownum; } tbody { counter-reset: rownum; } table.name td.row:before { content: counter(rownum); } </style> </head> <body> <table class="name"> <thead> <tr> <td>#</td> <td>Item</td> <td>Description</td> </tr> </thead> <tbody> <tr> <td class="row"></td> <td>Mac</td> <td>Apple</td> </tr> <tr> <td class="row"></td> <td>Windows</td> <td>Microsoft</td> </tr> <tr> <td class="row"></td> <td>Ubuntu</td> <td>Linux</td> </tr> <tr> <td class="row"></td> <td>Sun Solaris</td> <td>Sun</td> </tr> </tbody> </table> </body> </html>
Preview before sorting
Preview after sorting
Benefits
If you are using programmatic counters created using php or asp.net, and you apply table sorters the counter column also gets sorted. In some cases it does not matter but if it does then you can use the css counter because table sorters have no effect on them.
Clearfix for floats
When you use float on an element other styles like background color may not apply on it. So to workaround this problem we can create a class called clearfix. This class can be applied to all element containing floating elements.
for example consider this piece of xhtml code
Well the background color of menu should be red but due to float the height of ul will be zero so we after clearfix to cancel the effect of floats and get the result we want.
After applying clearfix
for example consider this piece of xhtml code
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Testing Clearfix</title> <style type="text/css">
body { font: 13px/1.5em Tahoma; }.h-menu li { float: left; display: block; width: 100px; } .h-menu { background: Red; } </style> </head> <body> <ul class="h-menu"> <li>Home</li> <li>Members</li> <li>About</li> <li>Contact</li> </ul> </body> </html>
Well the background color of menu should be red but due to float the height of ul will be zero so we after clearfix to cancel the effect of floats and get the result we want.
/* ----- clear fix for floats ----- */ .clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .clearfix { display: inline-block; } /* hides clearfix from IE-mac \*/ * html .clearfix { height: 1%; } .clearfix { display: block; } /* end hide from IE-mac */
After applying clearfix
<ul class="h-menu clearfix"> <li>Home</li> <li>Members</li> <li>About</li> <li>Contact</li> </ul>
Subscribe to:
Posts (Atom)



