Even though using very specific CSS selectors works it makes it a lot
harder to write that CSS.

Is there a way to force Wicket to write parent CSS contribution after
the children's CSS contribution?

Thanks,

Alec

On Sat, Apr 23, 2011 at 8:06 PM, Alec Swan <[email protected]> wrote:
> Thanks for the ideas, Clint. The child components do not know about
> parent CSS, so I decided to use more specific CSS selectors in the
> parent CSS to accomplish what I needed.
>
> Alec
>
> On Sat, Apr 23, 2011 at 4:35 PM, Clint Checketts <[email protected]> wrote:
>> I recall reading an article once noting that you could contribute the CSS
>> file noted in the parent class again in the child component and Wicket is
>> smart enough to not duplicate the contribution, but it still forces the CSS
>> file to appear later.
>>
>> You also may consider changing the parent CSS rules to be more specific or
>> generic (depending on your intentions), to allow them to cascade.
>>
>> -Clint
>>
>> On Sat, Apr 23, 2011 at 5:05 PM, Alec Swan <[email protected]> wrote:
>>
>>> Hello,
>>>
>>> I have a component tree where some components contribute CSS. I have
>>> inline CSS for the parent component that should be contributed last in
>>> order to override CSS of child components.
>>>
>>> Children components contribute their CSS in their constructors using
>>> add(new StyleSheetReference("cssId", getClass(), "/css/styles.css")).
>>> I have to use this approach because other approaches don't work with
>>> panel swapping (I have yet to create a JIRA issue for this).
>>>
>>> The parent component is contributing CSS by calling
>>> response.renderString("body {background-color:red}") from
>>> IHeaderContributor#renderHead(IHeaderResponse).
>>>
>>> I tried contributing parent CSS in parents onInitialize() and
>>> onBeforeRender(), but children's CSS always get written last.
>>>
>>> Is there any way to force parent's CSS to be contributed last?
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to