Fórumok

Add a CSS rule for just this portlet.

eks bee, módosítva 8 év-val korábban

Add a CSS rule for just this portlet.

New Member Bejegyzések: 3 Csatlakozás dátuma: 2014.04.08. Legújabb bejegyzések
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
David H Nebinger, módosítva 8 év-val korábban

RE: Add a CSS rule for just this portlet. (Válasz)

Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
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.
eks bee, módosítva 8 év-val korábban

RE: Add a CSS rule for just this portlet.

New Member Bejegyzések: 3 Csatlakozás dátuma: 2014.04.08. Legújabb bejegyzések
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!