title: How to apply CSS class (my style) to Pandas DataFrame using to_html
body: <p>Sorry, I am new to HTML and CSS. </p>
  
  <p>The goal is to create HTML table from dataframe and send it via email.</p>
  
  <p>But how can I stylish the output table? 
  Let's I want different background header, font, etc?</p>
  
  <p><strong>This is the style I want to implement:</strong></p>
  
  <pre><code>mystyle = 
  '''
  .mystyle {
      font-size: 11pt; 
      font-family: Arial;
      border-collapse: collapse; 
      border: 1px solid silver;
  
  }
  
  .mystyle td, th {
      padding: 5px;
  }
  
  .mystyle tr:nth-child(even) {
      background: #E0E0E0;
  }
  
  .mystyle tr:hover {
      background: silver;
      cursor: pointer;
  }
  
  '''
  </code></pre>
  
  <p><strong>So how can I implement <code>mystyle</code>  into below code and get stylish table? I tried <code>df.to_html(classes=mystyle)</code> but it did not work</strong></p>
  
  <pre><code>import smtplib
  from email.mime.text import MIMEText
  from email.mime.multipart import MIMEMultipart
  import pandas as pd
  import datetime as dt
  
  yesterday = dt.datetime.now() - dt.timedelta(days=1)
  date = "'" + yesterday.strftime('%m-%d-%Y') + "'"
  
  
  df = pd.DataFrame({
                  'Position': ['DBA','CEO','Underwriter']
                  ,'Salary': [100000,300000,60000]
                  ,'Posted':['2019-01-01', '2019-05-01', '2019-03-15']
                  ,'Link': ['myjob.com','ceo.com','insurance.com']
                  })
  html = """\
  &lt;html&gt;
    &lt;head&gt;Report for """ + date + """&lt;/head&gt;
    &lt;body&gt;
      {0}
    &lt;/body&gt;
  &lt;/html&gt;
  """.format(df.to_html())
  print(html)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/JudRc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JudRc.png" alt="enter image description here"></a></p>