I want to change the background of the page with title ='Home' for example, and I want to do it by lightning component.

I know that the Id of the page is NapiliCommunityTemplate ,

how to do this? can I reach the page style from the component?, or is there another way to do it.

Note: community is single page application so by builder I can set style which applied to all pages but not to specific one.

I tried this:


            var divx = document.getElementById('NapiliCommunityTemplate');// this return null
            divx.style.backgroundColor = '#FF0000';
            alert("Not FOund");                     

Please help.

1 Answer 1


You have to create a Custom Theme Layout and apply it to the Home Page through the Page Properties:

enter image description here

Under Layout > Theme Layout Type:

enter image description here

  • thanks for you answer.. I think its correct and I will try ... but why css condition does not work with community ?
    – sundus
    Jul 25, 2017 at 6:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .