开发者

CSS selectors - hierarchy

I have a table with the class "forum". I would like all p and a tags within the table to have a margin as follows:

.forum p,a { margin:2px; }

The above code however seems to be targetting ancor tags elsewhere on t开发者_StackOverflow社区he page aswell.. I cant see where i am going wrong..

Thanks in advance..


Try:

.forum p, .forum a { margin:2px; }

You need to specify .forum on both, otherwise it thinks you want to apply the style on ALL a tags.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜