Skip to main content
Inspiring
September 19, 2022
Answered

Best practice for creating the lines above add below the text for export to epub

  • September 19, 2022
  • 2 replies
  • 1873 views

I need to create these lines above and below a chapter title in ID. I can create a simple underline UNDERNEATH the text but what about above it? Once done corrdctly I have to export the doc as an epub and want to make sure there is good spacing.

 

Correct answer James Gifford—NitroPress

Here is the css for that style as it is

p.Main-Title-Border {
border-color:#5780ca;
border-style:solid;
border-width:1px 0px 1px 0px;
color:#00aeef;
font-family:"Minion Pro", serif;
font-size:2.25em;
font-style:normal;
font-variant:normal;
font-weight:normal;
line-height:1.2;
margin-bottom:0;
margin-left:0;
margin-right:0;
margin-top:0;
orphans:1;
page-break-after:auto;
page-break-before:auto;
text-align:center;
text-decoration:none;
text-indent:0;
text-transform:none;
widows:1;
}
 
If I ADD the rules you posted the width of the line does not change
 
p.STYLENAME {
border-top: solid 2px black;
border-bottom: solid 2px black;
padding-top: 10px;
padding-bottom: 10px;
}

Ha.

 

Add the parameter "width: min-content;" to the CSS definition. This does not work in Kindle (my usual end point) but does work in my two primary test EPUB readers.

 

(EPUB is secondary for me, so if it doesn't work in Kindle, I tend to forget about it.)

 

And if you want some slight extension of the lines beyond the text, add small amounts of left and right padding.

 

2 replies

BobLevine
Community Expert
Community Expert
September 19, 2022

Assuming that's a single paragraph, use the rule above and the rule below in the paragraph style definition.

James Gifford—NitroPress
Legend
September 19, 2022

Unfortunately, no. ID does not export Rule Above and Rule Below to EPUB. The settings are discarded.

 

The only way to do a rule above and/or below is with Paragraph Border, and the only parameters that will be exported are line type and width. Line types are limited to those available in HTML/CSS, so it's best to stay with the simple types if you use anything but solid.

 

Since ID does not export padding, at all, in any style or setting, the spacing of the lines above and below the text (and to the sides, if used) will be a default amount that cannot be adjusted from within ID. In other words, you pretty much take what ID chooses to give and that's that.

 

All of this can be tweaked — extensively — with CSS adjustment of the style. Anything that can be achieved on a web page or other HTML document can be achieved by adjusting the "border" values for the style at the CSS level.

 

Willi Adelberger
Community Expert
Community Expert
September 19, 2022

Some Possibilities in Paragraph Styles:

  • Paragraph Frame
  • Rulers abover and below