Making 1 pixel thin vertical separator lines - HTML tricks
Sponsored Links
Do you want a newspaper kind of layout for your web pages? This tip will show you how to do that using a thin (1 pixel width) vertical separator. |
It involves designing pages with fixed sizes and a good working knowledge of the <TABLE> tag. If you want to know more about HTML tables, go to the advanced HTML tutorial. |
The layout above consists of a table 301 pixels wide. This table has only one row with three cells. The first and the last cells are 150 pixels wide while the middle one is 1 pixel wide. It's the center cell that makes the vertical separator.
The code is:
<table width="301" cellpadding="0" cellspacing="5" border="0"> <tr> <td>So you want a newspaper kind of...</td> <td width="1" bgcolor="#000000"><img src="1-1.gif" width="1" height="1" border="0" alt="" /></td> <td>It involves designing pages with...</td> </tr> </table>
Important points
- Width of the table is specified in pixel values. This yields a fixed table size. You can use % values in the width attribute but then would have to test the code in both Internet Explorer and Netscape Navigator.
- The cellpadding attribute is set to zero. Any other value will result in thickening of vertical separator.
- Cellspacing will add some space around the text in columns, which indents in from the separator. You can choose any value for this attribute to suit your needs.
- The width of the middle cell determines the thickness of the vertical separator. In this case, its set to 1 because that's what we want.
- The bgcolor of the middle cell is black (#000000). This results in a black colored separator. You can thus change the color of the separator by changing the background color of the table cell.
- The content of the center cell is a 1 X 1 transparent pixel image - 1-1.gif in the code above. Some web developers might use the Netscape Communicator specific <SPACER> tag, but I suppose that this will be dropped in the next version of the browser and is best avoided. The 1 X 1 pixel image is only 49 bytes! You can download its zip file from here. (Note: You cannot leave the center cell empty. You can't use since this will thicken the separator. The best bet is to use a 1 X 1 pixel transparent gif.
Click this button if you liked the article!
Page contents: Create a newspaper layout on your web pages using a 1 pixel thin vertical separator line.
Comments, questions, feedback... whatever!
Recent Articles
Recent Blog Posts
Popular Articles
- Hotmail Sign In page
- Create a Hotmail account - Instructions
- Create Gmail address
- Download and install Outlook Express
- Get your free Gmail address
- Outlook Express new version
- Create my own email address
- Browers for Windows list
- Get email address
- Color combinations for web sites and pages
- Create Yahoo ID
More web tips & tricks
- Outlook Express Help - tips & tricks (53)
- Windows Live Mail help and tips (36)
- Windows Mail help (25)
- Hotmail help and tips (42)
- Yahoo help & support (45)
- AOL email help (26)
- Gmail help and tips (36)
- Internet tips & tricks (12)
- Web Design tips & tricks (33)
- HTML, Javascript tips tricks (68)
- Web Promotion tips & tricks (8)
- Graphics tips & tricks (20)
