Jump to content

There Is No 'cellpadding' But... (firefox =s)


utkesmer
 Share

Recommended Posts

Here is the code.

<table border="1" align="center" cellpadding="15px" style="width:95%; height:100%">  <tr valign="middle">	<td>		  <table border="1" width="100%" align="center"><tr>		<td><p align="center">Ana Sayfa</p></td>		<td><p align="center">Soldat Nedir?</p></td>		<td><p align="center">Server Kurulumu ve Yönetimi</p></td>		<td><p align="center">İletişim</p></td>	  </tr></table>	</td>  </tr></table>

This is the preview in IE.20090621153557.jpgThis is the preview in Firefox.20090621153541.jpgHelp.

Edited by utkesmer
Link to comment
Share on other sites

The <p> element, in standard compliant browsers, has margin above and below it.Don't use a <p> element there. <p> elements are for paragraphs, and it's incorrect to use them for anything else.If you want to center the text in the table cell, use CSS on the <td> element. If you don't know CSS, there's a tutorial on W3Schools for that.

Link to comment
Share on other sites

Guest FirefoxRocks

Even with transitional (X)HTML you can use the align attribute on the <td> element. But since we promote and aim for strict (X)HTML, your code should look something like this:

<table border="1" cellpadding="15" style="width:95%; height:100%; text-align: center; margin: 0 auto">  <tr style="vertical-align: middle">    <td>          <table border="1" style="width: 100%; text-align:center">       <tr>        <td>Ana Sayfa</td>        <td>Soldat Nedir?</td>        <td>Server Kurulumu ve Yönetimi</td>        <td>İletişim</td>      </tr></table>    </td>  </tr></table>

Nested tables are a bad idea.

Edited by FirefoxRocks
Link to comment
Share on other sites

Even with transitional (X)HTML you can use the align attribute on the <td> element.
But align doesn't provide anything useful to the <td> and it just adds more mark-up to the document. Using CSS you can save bandwidth and loading times by putting all the presentation into a stylesheet rather than scattered all over the HTML document. And stylesheets are cached by browsers.
Link to comment
Share on other sites

Even with transitional (X)HTML you can use the align attribute on the <td> element. But since we promote and aim for strict (X)HTML, your code should look something like this...
The <p> element, in standard compliant browsers, has margin above and below it.Don't use a <p> element there. <p> elements are for paragraphs, and it's incorrect to use them for anything else.If you want to center the text in the table cell, use CSS on the <td> element. If you don't know CSS, there's a tutorial on W3Schools for that.
How can I use the align attribute on CSS without <p> or other elements...Thank you. :)
Link to comment
Share on other sites

In a CSS stylesheet you write
td { text-align: center }

You should look at the W3Schools CSS tutorial. CSS can be applied to any element.

But you said...
But align doesn't provide anything useful to the <td> and ...
Ovvv, I am understanding now. :) You just said external stylesheet cached by browser so don't use inline style... bla bla...Ok, thanks. :)
Link to comment
Share on other sites

But you said...Ovvv, I am understanding now. :) You just said external stylesheet cached by browser so don't use inline style... bla bla...Ok, thanks. :)
align is an HTML attribute that is deprecated, used like this:
<td align="center">

text-align is a CSS property, it can be used in an external stylesheet (recommended), or posted inline like this:

<td style="text-align: center;">

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...