utkesmer Posted June 21, 2009 Share Posted June 21, 2009 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.This is the preview in Firefox.Help. Link to comment Share on other sites More sharing options...
Ingolme Posted June 21, 2009 Share Posted June 21, 2009 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 More sharing options...
Guest FirefoxRocks Posted June 21, 2009 Share Posted June 21, 2009 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. Link to comment Share on other sites More sharing options...
Ingolme Posted June 21, 2009 Share Posted June 21, 2009 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 More sharing options...
utkesmer Posted June 21, 2009 Author Share Posted June 21, 2009 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 More sharing options...
Ingolme Posted June 21, 2009 Share Posted June 21, 2009 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. Link to comment Share on other sites More sharing options...
utkesmer Posted June 22, 2009 Author Share Posted June 22, 2009 In a CSS stylesheet you writetd { 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 More sharing options...
Ingolme Posted June 22, 2009 Share Posted June 22, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.