Prev: Sprites for screen readers
Next: Center Table using CSS
From: Jukka K. Korpela on 16 Feb 2010 11:32 David Stone wrote: >> TABLE TD { .... } .... > It means, "apply the rules { .... } to any td which is a direct > descendent of a table" Wrong. Next time, consider reading the responses already posted, before throwing in your guesses. > So the corresponding html would be > > <table> > <td>...</td> Wrong, and that would be invalid markup. > This selector is perhaps a trifle redundant Wrong. > Note that I've used em units instead of px so that the spacing scales > with the user's chosen text size. Well, that part was right, but a top margin of 2em tends to be too large, and it's generally greater than one was thinking when he thought in terms of pixels and wrote 20px. -- Yucca, http://www.cs.tut.fi/~jkorpela/
From: David Stone on 16 Feb 2010 09:41
In article <4b76c510$0$6551$9b4e6d93(a)newsspool4.arcor-online.net>, cpet_magnus(a)hotmail.com (Camille Petersen) wrote: > When I inspect a CSS I found entries of the kind > > TABLE TD { .... } > > Mind the blank betwen the two tags! What does that mean? > Do all following instructions apply to the list of tags before? It means, "apply the rules { .... } to any td which is a direct descendent of a table" So the corresponding html would be <table> <td>...</td> etc. This selector is perhaps a trifle redundant for a number of reasons (not least that it ignores the intervening <tr>!) If the author's intent was to style all <td>s with the rule, then they could have omitted the <table> > I thought such a list will be concatenated by commas. It's not a list, although it could be. > Furthermore I would like to setup a margin before (=to the top/north) of a > TABLE. > Can I simply write > > margintop: 20px; > > Or how do I specify it otherwise? If you only have one table in the file, and the css applies only to that file, you can write table { margin-top: 2em } If you have more than one table, or the css will apply to more than one file but you only want _this_ particular table to receive the margin, use a class or unique ID: table.givemespace { margin-top: 2em } table#givemespace { margin-top: 2em } Note that I've used em units instead of px so that the spacing scales with the user's chosen text size. You should also be aware that you may not see quite what you expect, depending on the margin-bottom of the preceding item being displayed on the page. |