Learn how to define CSS inline and externally within the component decorator metadata.
- [Instructor] Defining CSS in an Angular…template is very similar to how you define HTML.…Within the component decorator,…you can choose to write inline CSS.…You could use the styles URL property…to import an external style sheet,…and you can also write inline CSS…with the template property.…Additionally, you can also define…CSS within a global stylesheet.…Let's take a look at each of these methods of defining CSS.…The Angular command line interface generates…an app.component.css stylesheet and defines it…within the style URL's property as seen on line 12.…
If we take a look at this CSS file,…we'll notice that it's blank.…Let's write a rule set for this h1 tag.…We'll save it, and let's switch…over to our browser and we'll now…see that it has changed our title to red.…Simple enough.…Going back to this external stylesheet,…let's copy our rule set and revert…back to our app.component.ts file.…
To define inline CSS, we simply…change the style URL's property to styles,…and as with the HTML, let's also add backticks…and let's paste in the h1 rule set…
- How components work
- Defining HTML templates
- Defining CSS
- Class binding and style binding
- Property binding and event binding
- Creating routes for navigation
Skill Level Intermediate
1. Getting Up and Running with Angular
2. Templating Basics
3. Data Binding
5. Tying It All Together
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.