开发者

CSS selectors - hierarchy

开发者 https://www.devze.com 2023-03-11 09:15 出处:网络
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:

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

精彩评论

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