[Seaside] styles in embedded components (2.9)

Ramon Leon ramon.leon at allresnet.com
Tue Dec 23 22:47:54 UTC 2008

> I have a component that has css definitions in a style method. Now I
> embed this component in another component. Should I expect that the
> style definitions of the embedded component will also show up in the
> resulting page?

Yes, all #style methods create a css include.

> So now this works when used as a root component not as an 
> embedded one.
> Alex

CSS is one big flat namespace, all styles are global.  If you don't want a
subcomponents style affecting it's parent component, you need to build your
CSS with that in mind. 

Say you have a comment form, you can wrap its render in a div with class
commentForm then write your css scoped to that like this...

.commentForm p {...}

To only have that style apply to paragraph tags inside the comment form and
not affect the parent components tags.

Ramon Leon

More information about the seaside mailing list