Guest Cashster09 Posted May 6, 2009 Report Posted May 6, 2009 (edited) I was wondering if there was a good explanation somewhere as to text-align: center and when to use it and when to use margin and width: auto for tables and td's? It's kinda confusing... text-align is inherited by the elements below it....what exactly does that mean? Edited May 6, 2009 by Cashster09
Wickham Posted May 6, 2009 Report Posted May 6, 2009 (edited) I suppose it really depends on the type of page you are designing. It's probably best to think of all the general styles that will apply to the whole page, in fact the whole website of many pages, and code them into the body style, say for font-family, font-size, color and so on (you could put text-align: center here too but then you might need to change it in some places). Then when you have a containing element like a div in a particular area of you page, like a sidebar or menu, create a class for that div and define different styles. Tables should not be used to format a whole page, use divs and CSS. Use tables just for part of a page where you want to display tabular data, like a calendar or a schedule of products and prices. In which case the table will probably have a defined width, but width: 100% or width: auto is not wrong. it just depends on the circumstances. As far as inheriting styles is concerned, some do, some don't, and it's best to experiment. Edited May 6, 2009 by Wickham
PicnicTutorials Posted May 6, 2009 Report Posted May 6, 2009 I think in this case it's best to think in terms of block level elements and inline level elements. Once your able to grasp that concept, and what elements they refer too, it all starts to fall in place. Text-align center only centers inline elements. Margin auto only centers block level elements (with a width). And of course, those can all be interchanged by altering their default state.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now