HTML Cookbook Basic HTML Course

It's Easy!

Simulating CSS Margins with WebTV

Problem: WebTV Margin Limitation

WebTV (MSNTV) can only read margin-left for CSS margins.

Each of the following solutions is an example of itself. I have added borders so you can see the effect for each.


Q: How do I get margins at the top, at the bottom and on the right for WebTV?


A1: To get space on the top or bottom, just use <br /> tags.



A2:To get equal space on the left and right sides, you can use a "narrrow" div centered inside a "wide" div:

<div style="text-align:center; width:100%">
<div style="text-align:left; width:90%">

Content goes here

</div>
</div>

The first div centers the content that is in it (another div). It does not center the div on the page. The second div aligns the text to the left of the "inner part".




A3: Another approach for equal space on the left and right sides is to use a table.

<table align="center" width="86%"
cellspacing="0" cellpadding="0" border="0">
<tr><td>

Content goes here

</td></tr></table>



 

A4: If you need left and right margins that are not the same width, you can use a table with empty cells as left and right spacers.

<table cellspacing="0" cellpadding="0" border="0"><tr>

<!-- left margin -->
<td width="10%"></td>

<td >
Content goes here
</td>

<!-- right margin -->
<td width="6%"></td>

</tr></table>


HTML Course Contents (Home)

Valid XHTML 1.0!

Valid CSS!