Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TD align to center
Message
 
To
25/09/2012 21:17:55
General information
Forum:
HTML5
Category:
Other
Miscellaneous
Thread ID:
01553647
Message ID:
01553654
Views:
78
This message has been marked as a message which has helped to the initial question of the thread.
Michel,

My default stylesheet has td text-align:left because that's the 90% case. If I need centered or right aligned I override the setting for the specific element typically with a right-align or center-align class (or element style if you have to).

Not specifying text-align: left causes a lot of problems as the setting otherwise is 'inherit'. If the table's outer element has text-align: center all columns in the table will center which is surely not what you want.

In my standard CSS file I have:
td
{
    text-align: left;
    vertical-align: top;
    padding: 4px;
}
table.grid>tbody>tr>td
{
	border: solid 1px lightgrey;	
}
th
{
	font-weight: bold;
	text-align: center;
}
Hope that helps,

+++ Rick ---

>In HTML5, depending on the context, some TD cell alignments might end up to be aligned centered even if you did not specify to. This is just how HTML5 renders its stuff.
>
>So, I thought I would put this in my stylesheet:
>
>
>TD
>{
>   Text-Align: Left;
>}
>
>
>While this resolves some issues, it causes some more as this has priority over the attribute ALIGN=CENTER, for example.
>
>I would like to know how you handle it. Do you prefer to have it declared at the stylesheet level and fix at every locations or not having it at the stylesheet level but to fix those locations where the TD cell appears centered?
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform