掲示板

Add a CSS rule for just this portlet.

8年前 に eks bee によって更新されました。

Add a CSS rule for just this portlet.

New Member 投稿: 3 参加年月日: 14/04/08 最新の投稿
Hello,

I'm having trouble adding CSS rule for "just this portlet".

To start with i have very little to no experience with css so thats probably my problem.

In Liferay 5.2.3 i clicked the text "Add a CSS rule for just this portlet"

which adds the following code:


#portlet-wrapper-tvprintqueue_WAR_tvportlet{

}



if I want to apply the following css into this wrapper, how do i do it correctly?


input[id="_tvprintqueue_WAR_tvportlet_:j_id2:j_id7"]
{
display: none;
}


i've tried, which didnt work.


#portlet-wrapper-tvprintqueue_WAR_tvportlet{

     input[id="_tvprintqueue_WAR_tvportlet_:j_id2:j_id7"]
     {
     display: none;
    }
}


Could somebody please advise?
thumbnail
8年前 に David H Nebinger によって更新されました。

RE: Add a CSS rule for just this portlet. (回答)

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
You have to combine the selectors in parent/child form:

#portlet-wrapper-tvprintqueue_WAR_tvportlet input[id="_tvprintqueue_WAR_tvportlet_:j_id2:j_id7"]
{
display: none;
}

This says to set the display style to none for the input with id _tvprintqueue_WAR_tvportlet_:j_id2:j_id7 within any element inside an element with id portlet-wrapper-tvprintqueue_WAR_tvportlet.

Given that you're using an id for the input (bad idea, imho), you don't even need the portlet wrapper guy. The id will be unique on the page so there will be no conflict.

BTW, if you're going to be doing CSS in the portal, you really should learn some CSS. You're now standing at the top of a very slippery slope and, should you mess up your CSS, you could find yourself breaking your portal in ways you might not expect.
8年前 に eks bee によって更新されました。

RE: Add a CSS rule for just this portlet.

New Member 投稿: 3 参加年月日: 14/04/08 最新の投稿
David H Nebinger:
You have to combine the selectors in parent/child form:

#portlet-wrapper-tvprintqueue_WAR_tvportlet input[id="_tvprintqueue_WAR_tvportlet_:j_id2:j_id7"]
{
display: none;
}

This says to set the display style to none for the input with id _tvprintqueue_WAR_tvportlet_:j_id2:j_id7 within any element inside an element with id portlet-wrapper-tvprintqueue_WAR_tvportlet.

Given that you're using an id for the input (bad idea, imho), you don't even need the portlet wrapper guy. The id will be unique on the page so there will be no conflict.

BTW, if you're going to be doing CSS in the portal, you really should learn some CSS. You're now standing at the top of a very slippery slope and, should you mess up your CSS, you could find yourself breaking your portal in ways you might not expect.



Thank you David, that worked fine. Much appreciated!