Displaying blocks of code online : code « Tags « HTML / CSS






Displaying blocks of code online

    


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Displaying blocks of code online</title>
<style type="text/css" media="screen">

body {
    font: 62.5%/1.5 Verdana, Arial, Helvetica, sans-serif;
    padding: 20px;
}
    
.codeList {
    border: 1px solid #aaa;
}
    
.codeList dt {
    background: #dddddd;
    padding: 7px;
    font-weight: bold;
    border-bottom: 2px solid #ccc;
}
    
.codeList li {
    background: #ddd;
    margin-left: 2.5em;
}
    
.codeList code {
    background: #eaeaea;
    display: block;
    border-bottom: 2px solid #ffffff;
    border-right: 2px solid #ffffff;
    font : 1.2em "Courier New", Courier, monospace;
    padding: 2px 10px;
}
</style>
</head>
<body>
  <div id="wrapper">
    <dl class="codeList">
      <dt>Writing out list styles in full</dt>
      <dd>
        <ol>
          <li><code>import java</code></li>
          <li><code>class MainClass{</code></li>
          <li><code>  int i;</code></li>
          <li><code>public static void main</code></li>
          <li><code>}</code></li>
        </ol>
      </dd>
    </dl>
  </div>
</body>
</html>

   
    
    
  








Related examples in the same category

1.code Element For Adding Code to Your Web Pages
2.code must be within pre (inline elements can't contain block-level elements)
3.Blocked and preserved Code
4.Formula input
5.code margin: 5px 0;
6.code padding: 10px;
7.code text-align: left;
8.code display: block;
9.code overflow: auto;
10.code font: 500 1em/1.5em 'Lucida Console', 'courier new', monospace ;
11.code background: #F5F5F5;
12.code border-left: 3px solid #D4D4D4;
13.code font-family:courier, monospace;
14.code font-size:12px;
15.code font-weight:bold;
16.code border:1px solid #000000;
17.code {display:block;}
18.code font-family: courier;
19.code color: #000000;
20.code font-size: smaller;
21.code background-color: #d6d6d6;
22.code padding: 2px;
23.code margin: 5px;
24.code padding: 3px;
25.code background-color: black;
26.code color: #FFFFFF;
27.Code style
28.'code' Example