Now it's time to add some CSS styles to that static markup you created in the previous exercise. This section will introduce you to adding class names in React, and using CSS variables.
You add class names in TSX by using the className
attribute like this:
<div className="myclass">contents</div>
This class can then be styled in your css by prepending the class name with a period:
.myclass {
color: red;
}
A CSS file has been created for you with the class definitions and two variables have been declared for the background color of the messages: --message-color-ai
and --message-color-user
.
<p>
tags with class names "message ai
" and "message user
". To find out more about CSS variables, or anything else you need to know, ask me here: