Horizontal Rules
[Previous] [Main] [Next]

 
Horizontal rules appear as visible lines on a web browser. They're used to logically separate documents into separate sections to make them visually more appealing and easier to read. The htmlHorizontalRule class encapsulates the HTML <HR> tag.  
 
htmlHorizontalRule inherits from htmlObject. Therefore, it's intended to be added to other objects and does not accept objects on it's own.  
 
You can control the thickness of a horizontal rule using the Size() method. By default, horizontal rules are rendered across the entire width of the display area. If you do not want to use the entire width, the Width() method lets you specify the width as a percentage of the display, or as a fixed number of pixels.  
 
Example Use
 
#include <stdio.h>  
#include <stdlib.h>  
#include <dcmicro/htmlpp/htmlpp.h>  
 
int main( void )  
{  
   htmlCgi   server ;  
   htmlPage  page( "html++ example application" ) ;  
 
   page << "Default rule" << htmlHorizontalRule() ;  
 
   htmlHorizontalRule   hr1 ;  
   hr1.Width( "50%" ).Size( 10 ) ;  
   page << "50% wide, 10 pixels thick" << hr1 ;  
 
   htmlHorizontalRule   hr2 ;  
   hr2.Width( 200 ).Shade( shade_shaded ) ;  
   page << "200 pixels wide, shaded" << hr2 ;  
 
   htmlHorizontalRule   hr3 ;  
   hr3.Shade( shade_solid ).Align( align_right ) ;  
   page << "Default width, solid, right-align" << hr3 ;  
 
   server << page ;  
   return 0 ;  
}  
 
Program Output
 
Content-Type: text/html  
<HTML>  
<HEAD>  
<TITLE>html++ example application</TITLE>  
</HEAD>  
<BODY>  
Default rule<HR>  
50% wide, 10 pixels thick<HR WIDTH="50%" SIZE="10">  
200 pixels wide, shaded<HR WIDTH="200">  
Default width, solid, right-align<HR NOSHADE ALIGN="RIGHT">  
</BODY>  
</HTML>  
 
horizrul.gif  

 


©1998 DC Micro Development. All rights reserved.
No portion of this document may be c opied or reproduced without expressed written consent.
html++ is a trademark of DC Micro Development.