HTML TUTORIAL


Preserving leading space in HTML Tables


Let me state the problem first. You have an HTML table and you wish to have one or two white space just at the begining so that the starting letter does not look like touching the table borders. Look at the table to understand the problem.

Table : jQuery Selectors


jQuery Element Description Example
Element Name Represents an Element name available in the page. $('p') selects all paragraphs in the document.
Elemeny ID Represents an Element available with the given ID . $('#foo') selects the single element in the in the document that has an ID foo.
Element Class Represents an element available with the given class. $('.foo') selects all elements in the document that have a class of foo.

The solution


There is one very simple solution to the problem. All you do is - enclose the contents inside a <pre> and </pre> tags. That is it. Here is how the same table looks like when you enclose the contents inside these tags.

Table : jQuery Selectors
jQuery Element Description Example
 Element Name  
 Represents an Element name available in the page.  
 $('p') selects all paragraphs in the document. 
 Elemeny ID 
 Represents an Element  available with the given ID . 
 $('#foo') selects the single element in the  in the document that has an ID foo. 
 Element Class 
 Represents an element  available with the given class. 
 $('.foo') selects all elements in the document that have a class of foo.