How to embed HTML and CSS in a custom form element? This worked in Drupal 7 but isn't in Drupal 8.

$form['covid-19'] = array(
    '#markup' =&gt; '&lt;div style="border: 2px solid red;padding:10px;margin-bottom:10px;"&gt;&lt;strong&gt;Due to the COVID-19 situation, we will only be purchasing e-books and e-audiobooks at this time.&lt;/strong&gt; You are welcome to enter your information for print books, DVDs, or CDs, and they will be purchased when the libraries re-open.  Inter-library Loans [loans from outside Yavapai County] are suspended for now.&lt;/div&gt;',
);


I want the div with style info to stay intact so I can just comment it out when the crisis is over. Then I want to leave it there as a placeholder ready for the next crisis.

In this example, the strong tag makes it through but the div does not.

I also tried setting the div info as a #prefix and #suffix but that didn't work either. 

Is there a way to do this?

Thank you!
Markup strips away some tags and attributes. Here is a way to do it.

Add a class to your form 

$form['#attributes']['class'][] = 'crisis';


Add css rule to your theme's css

.crisis {
    display: none;
} 


if you do not have a library and a .css file to use, you need to create them. Define a library in your theme or module in your THEMEorMODULE.libraries.yml

crisis:
  version: 1.x
  css:
    theme:
      css/crisis.css: {}


create css/crisis.css file and put your css rule(s) in it

and attach the library to your form

$form['#attached']['library'][] = 'THEMEorMODULE/crisis'


and clear cache 

NOTE: The above (pseudo)code is not tested.  For more information please have a look here