Background Attribute Example – HTML Syntax – Background HTML Example

Background Attribute Example – HTML Syntax – Background HTML Example

Summary: – Illustrates the HTML Syntax for the background attribute.
Prerequistes:

If you do not want to build a library of syntax examples, you can download an excellent free html editor at nvu

Restrictions: None

Notes:

  • You can build your own library of syntax examples by using same web site over and over and just add new files to it.

Instructions:

  1. Use Visual Studio 2022 or current edition
  2. Create new web site;
    • Select Create New Project
    • Select ASP.NET Web Forms Site Template
    • Select C-Sharp for Language
    • name of Web Site could be HTML_Syntax.
  3. Add New folder named “BackgroundAttributes”
    • Right-click project name in solution explorer;
    • add new folder;
    • name of folder should be: BackgroundAttributes
  4. Add HTML Page Named Abbr to BackgroundAttributes folder
    • Right-click BackgroundAttributes folder;
    • add new item;
    • Select HTML Page
    • HTML Page name could be bgcolor
  5. Click on copy code in code below to copy code into HTML Page bgcolor.htm
  6. Right-click on HTML page bgcolor and select view in browser
  7. Purpose: bgcolor=”color” or bgcolor=”#rrggbb” Specifies the background color for an element.

    View Example In Browser

     
        <title>Example For bgcolor</title>
     
     
      <center><a href="http://myqol.com">Progress Monitor has 100s of Code Samples and Video Tutorials</a></center>
        <!--bgcolor="color" or bgcolor="#rrggbb"-->
     
    <table bgcolor="red">
            <!-- row 1-->
     
    <tbody>
     
    <tr height="50px">
     
    <td bgcolor="blue">
                        table cell
    </td>
     
     
    <td>
                        table cell2
    </td>
     
    </tr>
     
                <!-- row 2-->
     
    <tr colspan="2" bgcolor="green" height="50px">
     
    <td>
    </td>
     
     
    <td>
    </td>
     
    </tr>
     
                <!-- row 3-->
     
    <tr colspan="2" bgcolor="#ffff00" height="50px">
     
    <td>
    </td>
     
     
    <td>
    </td>
     
    </tr>
     
    </tbody>
     
    </table>