Tuesday, July 3, 2018

Style classes specific to the elements where they might sit with CSS.

Given this...

<h1 class="foo">bar</h1>
<ul class="foo">


If we want to make the h1 tag red and the copy at the unordered list green we may do so like so:

h1.foo {
   color: #FF0000;
ul.foo {
   color: #00FF00;


This is another something I learned from "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis. I thought it was strange that there was no space between the dot and the element tag beforehand at the CSS.

No comments:

Post a Comment