Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 02-05-2018, 04:45 PM   #1
mzso
Enthusiast
mzso began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Feb 2018
Device: PC
How to add a horizontal line under the header?

Hi!

I'm trying to add a horizontal line to the header, during conversion (to pdf). I tried everything I found and could think (<hr>, underline, bottom border)of but I can't get a line under the header. Only under the header text.

This is my header:
Code:
<div style="font-size:x-small;"><p style="float:left;">_TITLE_</p><p style="float:right;"><i>_SECTION_</i></p></div>


Any ideas?

Last edited by mzso; 02-06-2018 at 05:40 AM. Reason: Left out some stuff on the first try.
mzso is offline   Reply With Quote
Old 02-05-2018, 04:57 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by mzso View Post
Hi!

I tried everything I found and could think (<hr>, underline, bottom border)of but I can't get a line under the header. Only under the header text.

This is my header:
Code:
<div style="font-size:x-small;"><p style="float:left;">_TITLE_</p><p style="float:right;"><i>_SECTION_</i></p></div>


Any ideas?
BOXES (AKA the box model)
Where did you put the HR? or border?
Code:
<div>
<p> </p>
</div>
If the DIV sets the overall block margins, that is where it belongs

(FWIW I don't style inline since I learned about CSS)
theducks is online now   Reply With Quote
Advert
Old 02-05-2018, 05:22 PM   #3
mzso
Enthusiast
mzso began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Feb 2018
Device: PC
Quote:
Originally Posted by theducks View Post
BOXES (AKA the box model)
Where did you put the HR? or border?
Code:
<div>
<p> </p>
</div>
If the DIV sets the overall block margins, that is where it belongs
?

Everywhere... With the div it doesn't work. The border will always be at the top of the page.

Quote:
Originally Posted by theducks View Post
(FWIW I don't style inline since I learned about CSS)
There's only an input line for this so no other possibility...
mzso is offline   Reply With Quote
Old 02-05-2018, 07:07 PM   #4
deback
Book E d i t o r
deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.
 
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
Did you try one of the following?

<hr width="100px">

or

<hr width="50%">

(Change the numbers above to whatever you want...)

I don't understand the difference in your question between the "header" and the "header text."
deback is offline   Reply With Quote
Old 02-05-2018, 07:20 PM   #5
mzso
Enthusiast
mzso began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Feb 2018
Device: PC
Quote:
Originally Posted by deback View Post
Did you try one of the following?

<hr width="100px">

or

<hr width="50%">

(Change the numbers above to whatever you want...)

I don't understand the difference in your question between the "header" and the "header text."
It doesn't work. It won't extend to the width of the page.

The difference would be that wether the line extends all the way through the width of the page (minus margins).
mzso is offline   Reply With Quote
Advert
Old 02-05-2018, 08:12 PM   #6
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Maybe I'm totally misunderstanding the problem, but doesn't a plain, simple <hr/> tag display a 100%-width line?
jackie_w is offline   Reply With Quote
Old 02-05-2018, 08:27 PM   #7
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,998
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Where did you get that really really horrible code?
JSWolf is offline   Reply With Quote
Old 02-05-2018, 09:41 PM   #8
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by mzso View Post
?

Everywhere... With the div it doesn't work. The border will always be at the top of the page.



There's only an input line for this so no other possibility...
SHOW your code that fails. The entire block it is supposed to apply to.
<hr /> fills the space between margins of the current block

And I agrre with the Wolf. Pretty poor coding practice
theducks is online now   Reply With Quote
Old 02-06-2018, 04:13 AM   #9
mzso
Enthusiast
mzso began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Feb 2018
Device: PC
Quote:
Originally Posted by JSWolf View Post
Where did you get that really really horrible code?
From the documentation, linked from within the program.

Feel free to suggest something better.

Quote:
Originally Posted by jackie_w View Post
Maybe I'm totally misunderstanding the problem, but doesn't a plain, simple <hr/> tag display a 100%-width line?
Not in this case it seems. But feel free to combine <hr> with the code I have in a way that works. (Or present an analogous one, which works with <hr>)

Last edited by mzso; 02-06-2018 at 04:31 AM.
mzso is offline   Reply With Quote
Old 02-06-2018, 04:17 AM   #10
mzso
Enthusiast
mzso began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Feb 2018
Device: PC
Quote:
Originally Posted by theducks View Post
SHOW your code that fails. The entire block it is supposed to apply to.
<hr /> fills the space between margins of the current block
I already shared my code in the opening post. I tried to add a line dozens of ways, neither of which worked. If you have a (working) way to add a horizontal line to it via <hr> (or anything else) show it.

Quote:
Originally Posted by theducks View Post
And I agrre with the Wolf. Pretty poor coding practice
You can agree all you want. It's a scarcely modified version of the example in the documentation. (I changed the field to be show.)

Last edited by mzso; 02-06-2018 at 04:28 AM.
mzso is offline   Reply With Quote
Old 02-06-2018, 04:54 AM   #11
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
This is not a Calibre question. Moved to the ePub forum.
HarryT is offline   Reply With Quote
Old 02-06-2018, 05:38 AM   #12
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,998
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by mzso View Post
From the documentation, linked from within the program.

Feel free to suggest something better.
Better is using HTML/CSS. You might have to change the location of the stylesheet in the HTML to fit yours layout.

CSS Code:
Code:
body {
  widows: 1;
  orphans: 1;
  margin-top: 0;
  margin-right: 0;
  margin-bottom: 0;
  margin-left: 0;
  text-align: justify;
}
h2 {
  margin-top: 0.8em;
  margin-bottom: 0;
  text-align: center;
}
hr {
  border-top: 2px solid;
  margin-bottom: 1em;
}
p {
  margin-top: 0;
  margin-bottom: 0;
  text-indent: 1.2em;
}
.noindent {
  text-indent: 0;
}
HTML Code:
Code:
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<title>Dark in Death</title>
<link href="../styles/stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h2>TITLE</h2>
<hr/>
<p class="noindent">This is the first paragraph</p>
<p>This is the second paragraph</p>
</body>
</html>
JSWolf is offline   Reply With Quote
Old 02-06-2018, 05:43 AM   #13
mzso
Enthusiast
mzso began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Feb 2018
Device: PC
Quote:
Originally Posted by HarryT View Post
This is not a Calibre question. Moved to the ePub forum.
This is definitely not an epub question. It was in the conversion section for a reason. I have this issue when I try to convert to PDF. With Calibre of course.
(Though I concede that I neglected to mention this info in the OP)
mzso is offline   Reply With Quote
Old 02-06-2018, 05:44 AM   #14
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
It's a book coding question, though, not a conversion question.
HarryT is offline   Reply With Quote
Old 02-06-2018, 05:47 AM   #15
mzso
Enthusiast
mzso began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Feb 2018
Device: PC
Quote:
Originally Posted by JSWolf View Post
Better is using HTML/CSS. You might have to change the location of the stylesheet in the HTML to fit yours layout.

CSS Code:
Code:
body {
  widows: 1;
  orphans: 1;
  margin-top: 0;
  margin-right: 0;
  margin-bottom: 0;
  margin-left: 0;
  text-align: justify;
}
h2 {
  margin-top: 0.8em;
  margin-bottom: 0;
  text-align: center;
}
hr {
  border-top: 2px solid;
  margin-bottom: 1em;
}
p {
  margin-top: 0;
  margin-bottom: 0;
  text-indent: 1.2em;
}
.noindent {
  text-indent: 0;
}
HTML Code:
Code:
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<title>Dark in Death</title>
<link href="../styles/stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h2>TITLE</h2>
<hr/>
<p class="noindent">This is the first paragraph</p>
<p>This is the second paragraph</p>
</body>
</html>
Okay. I don't think I can do this. (Sorry, HarryT's post made me realize that I wasn't near clear enough in my OP, which I now updated. )

There's only a simple one line "header template" input field, for headers in the pdf output section, which I was talking about.
mzso is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
horizontal line on screen of Kobo Aura One sbin Kobo Reader 10 10-31-2016 08:47 AM
Horizontal line running through Nook HD+ Screen LornaH75 Nook Color & Nook Tablet 1 07-22-2013 07:53 PM
special characters e & i with horizontal line above cybmole Sigil 22 04-17-2013 11:00 AM
PRS-600 Horizontal line at start of chapter Gernella Sony Reader 0 01-03-2010 10:28 AM
Horizontal white line DrMoze Sony Reader 5 01-14-2008 10:57 AM


All times are GMT -4. The time now is 10:30 PM.


MobileRead.com is a privately owned, operated and funded community.