By default components don’t come with any CSS styles because the general idea is that every component should come with it’s own style. Let’s add styles to opportunityCard.cmp, then opportunitySelect.cmp and finally to opportunities.app.
opportunityCard.cmp
Add Styles
Open opportunityCard.cmp and click on the Styles button in the side panel of the Developer Console.
Copy the below CSS classes. To ensure css classes don’t clash, that every css class is namespaced with .THIS. At run-time .THIS will be replaced by a unique class name.
.THIS classname
Note: If your markup’s top level element uses any CSS class it’s namespace should not have a space between the THIS and the css-classname like .THIS.recordLayout. But if any inner element use a class they should have space like .THIS .myInnerElementCssClass
Update Markup
Update the markup of opportunityCard.cmp component to include some CSS classes (Remember to change the namespace).
opportunitySelect.cmp
Let’s add styles to opportunitySelect component.
Add Styles
Open opportunitySelect.cmp and click on the Styles button in the side panel of the Developer Console.
Copy the below CSS classes.
Update Markup
Update App’s markup to use these new styles.
opportunities.app
Let’s also add our app’s CSS.
Add Styles
Select the opportunities.app and click on Styles button and add the following css.
Update Markup
Update the markup of opportunitSelect.cmp component to include some CSS classes (Remember to change the namespace).
Test The App
Click on the Preview button in the side bar of the Developer console or go to: <your org>/<namespace>/opportunities.app in a browser.