What Is "line-height" Attribute?

This section describes 'line-height' attribute for 'inline' formatting object. It is used to control the line height of the output inline area.

What Is "line-height" Attribute? "line-height" is an attribute for inline-level formatting objects to specify the height of the output inline area, which will impact the height of the parent line area.

There are several rules you need to remember about "line-height" attribute:

Here is my tutorial example, inline-line-height-Attribute.fo, that shows an "inline" formatting object with "line-height" specified:

<?xml version="1.0" encoding="utf-8"?>
<!-- inline-line-height-Attribute.fo
 - Copyright (c) 2016, HerongYang.com, All Rights Reserved.
-->
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
 <fo:layout-master-set>
  <fo:simple-page-master master-name="page" 
   margin="0.1in" page-height="4in" page-width="3in">
   <fo:region-body region-name="body" background-color="#eeeeee"/>
  </fo:simple-page-master>
 </fo:layout-master-set>
 <fo:page-sequence master-reference="page">
  <fo:flow flow-name="body">
   <fo:block margin="0.1in" padding="0.2in" 
    border-width="1px" border-style="solid"
    background-color="#eeffff" color="#000000" 
    text-align="justify" font-family="sans-serif">
    Once upon a time there were three little pigs 
    <fo:inline font-weight="bold" background-color="#ffeeee"
    padding="3pt" border-width="5px" line-height="200%"
    border-style="solid">who lived with their Mother</fo:inline>.
    Early one morning they woke up and their mother said, 
    "you're too big for this house and its time you left home."
   </fo:block>
  </fo:flow>
 </fo:page-sequence>
</fo:root>

If you process this example XSL-FO document with RenderX XEP tool to a PDF file, you should see the height of lines where the "inline" formatting object is presented is higher than other lines:

"inline" - "line-height" Attribute

Note that Apache FOP does not support "line-height" attribute on "inline" formatting objects.

Last update: 2016.

Table of Contents

 About This XSL-FO Tutorial Book

 Introduction of XSL-FO

 Apache™ FOP (Formatting Objects Processor)

 RenderX XEP as an XSL-FO Tool

 Introduction of Area Model

 XSL-FO Document Basics and Examples

 Page Layout Masters

 Block-Level Formatting Objects

Inline-Level Formatting Objects

 What Are Inline-Level Formatting Objects?

 What Is "inline" Formatting Object?

 "inline" Splitting for Line Break

What Is "line-height" Attribute?

 What Is "baseline-shift" Attribute?

 "inline" with Mixed Content

 FOP Failed on "block" inside "inline"

 What Is "inline-container" Formatting Object?

 What Is "charecter" Formatting Object?

 What Is "leader" Formatting Object?

 What Are "page-number*" Formatting Objects?

 Including Graphics in XSL-FO document

 Table of Rows and Columns

 List, Item, Label, and Body

 Floating Blocks - "float" and "footnote"

 Hyperlinks, Table of Contents and Indexes

 Headers and Footers using "static-content"

 Font Attributes and Font Families

 Apache FOP Font Configurations

 RenderX XEP Font Configurations

 References

 PDF Printing Version