Pages

Tuesday, December 21, 2010

Computer Code Element



The Computer Code <code> element is used to designate text to be displayed as program code. The Computer Code <code> element used a mono-space font as its default.



Listed below are the most common attributes you can use for the computer code element:
  • class - provides the class or classes of the heading. This attribute is used to identify the name of the style class or classes to be used for rendering.
  • id - provides a unique name for the heading.
  • lang - provides the language in which the enclosed content is coded.
  • style - provides a cascading style sheet (CSS) properties to the heading.
  • title - privides a text title for the heading. Most web browser displays the value of the title as "tooltip".




Here's an example on how to use the computer code <code> element:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
         <meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
         <mate name="keywords" content="blog, web development" />
         <title>the COMPUTER CODE element</title>
     </head>

     <body>
       <h1>
         the COMPUTER CODE element
       </h1>
       <code>

            #include &lt;iostream&gt;<br />
            using namespace std;<br />
            int main()<br /><br />
           {<br />
            int myarray[5];<br />
            myarray[10] =99;<br />
            cout &lt;&lt; myarray[10] &lt;&lt; endl;<br />
            return 0;<br />
            }
        </code>
     </body>
 </html> 




Here's an example output of the computer code <code> element in a Safari web browser.

#include <iostream>
using namespace std;
int main( )

{
int myarray[5];
myarray[10] = 99;
cout << myarray[10] << endl;
return 0;
}



2 comments:

Unknown said...

this is a c++ code right?

sharky said...

@allan
yes it is. i hope my post will be helpful to you.
enjoy reading!!

Post a Comment