|
Headings
| [Previous] [Main] [Next] |
|
| |
| Headings are used to organize text into topics and subtopics, much like headlines in newspapers. There are six levels (sizes) of headings in the HTML specification, numbered one through six. The HTML tags for these headings appear as <H1></H1>, <H2></H2>, etc.
| |
|
| |
| Level 1 headings are rendered in the browser's largest font, while level 6 headings are rendered in the smallest font. Most browsers place blank lines before and after headings.
| |
|
| |
| Headings may be aligned (left, right, or center) using the Align() method, or via an alignment option in one of the constructors.
| |
|
| |
| The htmlHeading class represents headings in html++. The following example illustrates use of the htmlHeading class in a short application.
| |
|
| |
|
| |
| #include <stdio.h>
| |
| #include <stdlib.h>
| |
| #include <dcmicro/htmlpp/htmlpp.h>
| |
|
| |
| int main( void )
| |
| {
| |
| htmlCgi server ;
| |
| htmlPage page( "html++ example application" ) ;
| |
|
| |
| htmlHeading h1( 1 ) ;
| |
| h1 << "This is level 1" ;
| |
|
| |
| htmlHeading h2( 2, "This is level 2" ) ;
| |
|
| |
| htmlHeading h3( 3 ) ;
| |
| h3.Align( align_right ) << "This is level 3" ;
| |
|
| |
| page << "Heading examples"
| |
| << h1 << h2 << h3 ;
| |
|
| |
| server << page ;
| |
| return 0 ;
| |
| }
| |
|
| |
|
| |
| Content-Type: text/html
| |
| <HTML>
| |
| <HEAD>
| |
| <TITLE>html++ example application</TITLE>
| |
| </HEAD>
| |
| <BODY>
| |
| Heading examples<H1>This is level 1</H1>
| |
| <H2>This is level 2</H2>
| |
| <H3 ALIGN="RIGHT">This is level 3</H3>
| |
| </BODY>
| |
| </HTML>
| |
|
| |
| |
