locked
HTML Class RRS feed

  • Question

  • User-1314346660 posted

    Hi Experts,

    I have created a html class to help with some common formatting. Can I save this somewhere in my webforms solution so that I can reference this in multiple separate webforms without declaring/creating it on each page??

    Billson3000

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    .cities {
      background-color: black;
      color: white;
      margin: 20px;
      padding: 20px;
    } 
    </style>
    </head>
    <body>
    
    <div class="cities">
      <h2>London</h2>
      <p>London is the capital of England.</p>
    </div>
    
    <div class="cities">
      <h2>Paris</h2>
      <p>Paris is the capital of France.</p>
    </div>
    
    <div class="cities">
      <h2>Tokyo</h2>
      <p>Tokyo is the capital of Japan.</p>
    </div>
    
    </body>
    </html> 

    Wednesday, January 23, 2019 4:19 PM

Answers

  • User409696431 posted

    Yes.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 23, 2019 6:14 PM

All replies

  • User409696431 posted

    If you are talking about a style class, CSS, then put your CSS in an external style sheet, and reference that style sheet in each page.  The only CSS declarations that makes sense to put in the page itself is CSS that is only used on one page.   Put common styles in the external style sheet.

    Wednesday, January 23, 2019 5:43 PM
  • User-1314346660 posted

    Thank you Kathy. Can you reference the external style sheet in the site master so you don't need a reference on each page?

    Wednesday, January 23, 2019 5:56 PM
  • User409696431 posted

    Yes.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 23, 2019 6:14 PM
  • User-1314346660 posted

    Thank you Kathy!

    Wednesday, January 23, 2019 6:33 PM