I am developing a community and I would like it to look like lightning experience.
One main thing is the background picture that is dissolving into blue – I want to achieve a background like this:
So far I could get to this background:
with this code:
MARKUP:
<div class="allMainContainer">
<div class="lex_background">
This is my main component...
</div>
</div>
CSS:
.THIS.allMainContainer {
background-color: rgb(175, 197, 222);
height: -webkit-fill-available;
}
.THIS .lex_background {
background-image: url(/_slds/images/themes/oneSalesforce/banner-brand-default.png?cache=210.2);
background-repeat: repeat-x;
background-position: top left;
}
But as you can see – the background does not look nice
QUESTION:
How can I make my background to look exactly like Lightning experience?
Best Answer
In order to achieve the look you desire, you can use the built-in Brand Band component from the Lightning Design System by adding
extends="force:slds"
to your lightning app, which it appears you already have done, but there's a trick.First off, you're going to want to add the 3 following classes to your wrapper (where you have placed the class
allMainContainer
):slds-brand-band
,slds-brand-band_cover
, &slds-brand-band_medium
. This will give us the correct sizing and positioning for the Brand Band pseudo-elements.Unfortunately, it seems that the SLDS import is completely unbranded (I tried to find documentation on changing that, unsuccessfully), which means we haven't yet accomplished anything noticeable with this import. Next, we'll want to add a few CSS declarations to get things to actually appear. These are all based on the actual declarations in the Lightning Experience for the Lightning Blue theme that you wanted to copy.