Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 08-08-2010, 07:41 AM   #1
AlexBell
Wizard
AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.
 
AlexBell's Avatar
 
Posts: 2,319
Karma: 3943902
Join Date: May 2008
Location: Launceston, Tasmania
Device: Kindle3, Kobo Touch, Sony PRS T3, Nexus 7, iPad mini
How do I centre a horizontal rule?

I want to use horizontal rules as separators between subsections of chapters. It is easy to set them to 50% in the CSS, using

hr.half { height: 2px; color: black;
background-color: black; width: 50%;
}

and they work well and are centred when reading the book in HTML.

But when I read the book on my Cybook reader the horizontal rule is not centred; it is aligned left.

Is there a way to centre them in ePub? What do I need to add to the above segment of the stylesheet? Or, like small-caps, is this one of the things ADE cannot handle?

Regards, Alex
AlexBell is offline   Reply With Quote
Old 08-08-2010, 08:19 PM   #2
charleski
Wizard
charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.
 
Posts: 1,188
Karma: 727236
Join Date: Sep 2009
Device: PRS-505
margin-left: 25%

This is an old bug in ADE, would be interesting to know if they bothered to fix it in the version used for recent models like the PRS900.
charleski is offline   Reply With Quote
 
Advertisement
Old 08-08-2010, 11:21 PM   #3
sherman
Addict
sherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animals
 
Posts: 273
Karma: 6566
Join Date: Sep 2008
Location: New Plymouth - NZ
Device: Sony PRS-505/SC, B&N Nook, Sony PRS-650/BC, Kobo Glo
margin-left: 25% works if your horizontal rule has a width of 50%.

An alternate way is to set both margins to an identical value and do not specify a width.

eg: margin-left:30%; margin-right:30% would give a centered <hr> with a width of 40%.
sherman is online now   Reply With Quote
Old 08-09-2010, 05:20 AM   #4
AlexBell
Wizard
AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.
 
AlexBell's Avatar
 
Posts: 2,319
Karma: 3943902
Join Date: May 2008
Location: Launceston, Tasmania
Device: Kindle3, Kobo Touch, Sony PRS T3, Nexus 7, iPad mini
Many thanks to you both. I was so fixed on getting something like align: center; to work that I never thought of setting the margin.

Regards, Alex
AlexBell is offline   Reply With Quote
Old 08-09-2010, 06:37 AM   #5
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 6,259
Karma: 4801165
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
The "proper" way would be "margin: 0 auto", which should work for any width. But ADE does not support "auto", so you have to compute the margins yourself.
Jellby is offline   Reply With Quote
Old 08-09-2010, 10:54 PM   #6
Dark123
Zealot
Dark123 doesn't litterDark123 doesn't litter
 
Posts: 108
Karma: 105
Join Date: Jan 2010
Device: Kindle 3 WiFi
Have you tried to use this:

You could use <hr align="center" /> instead of using the CSS.
Dark123 is offline   Reply With Quote
Old 08-10-2010, 05:21 AM   #7
AlexBell
Wizard
AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.
 
AlexBell's Avatar
 
Posts: 2,319
Karma: 3943902
Join Date: May 2008
Location: Launceston, Tasmania
Device: Kindle3, Kobo Touch, Sony PRS T3, Nexus 7, iPad mini
Quote:
Originally Posted by eBookNewbie123 View Post
Have you tried to use this:

You could use <hr align="center" /> instead of using the CSS.
Thanks, but I think you'll find that align="center" is not acceptable in XHTML 1.1, which is the basis for ePubs.

Regards, Alex
AlexBell is offline   Reply With Quote
Old 09-07-2010, 11:10 PM   #8
Nathanael
Groupie
Nathanael ought to be getting tired of karma fortunes by now.Nathanael ought to be getting tired of karma fortunes by now.Nathanael ought to be getting tired of karma fortunes by now.Nathanael ought to be getting tired of karma fortunes by now.Nathanael ought to be getting tired of karma fortunes by now.Nathanael ought to be getting tired of karma fortunes by now.Nathanael ought to be getting tired of karma fortunes by now.Nathanael ought to be getting tired of karma fortunes by now.Nathanael ought to be getting tired of karma fortunes by now.Nathanael ought to be getting tired of karma fortunes by now.Nathanael ought to be getting tired of karma fortunes by now.
 
Posts: 185
Karma: 1110435
Join Date: Jul 2010
Location: Shanghai, China
Device: Sibrary G5
Quote:
Originally Posted by Jellby View Post
The "proper" way would be "margin: 0 auto", which should work for any width. But ADE does not support "auto", so you have to compute the margins yourself.
The proper way to center an <hr /> should be to just leave it alone, as align: center is supposed to be the default. But alas, there are far too many broken viewers out there, with ADE being one of the usual suspects.

--Nathanael
Nathanael is offline   Reply With Quote
Old 10-04-2010, 04:03 AM   #9
Req13
Member
Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!
 
Posts: 20
Karma: 100000
Join Date: Mar 2010
Device: Sony PRS-T1, PRS-600 & Nook STR
Setting the left and right margins works in the calibre viewer, but it is still aligned left when I view the epub in the Sony Reader Library. I don't have my prs-600 yet, but is that how it will show up on it?
Req13 is offline   Reply With Quote
Old 10-04-2010, 05:39 AM   #10
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
I played around on this a while back on my 505 and came up with this:

html:
Code:
  <div class="ruleclass">
    <hr />
  </div>
Stylesheet:
Code:
.ruleclass {
    margin-left: 5em;
    margin-right: 5em;
    }
hr {
   height: 3px;
   background:#505050;
   }
The hr styles are optional, the centering was accomplished by using the div. I'm sure there are alternate ways to do it, but I do recall arriving at that solution through trial and error, not sure what the specific failures were.

Last edited by ldolse; 10-04-2010 at 05:42 AM.
ldolse is offline   Reply With Quote
Old 10-04-2010, 11:29 PM   #11
Req13
Member
Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!
 
Posts: 20
Karma: 100000
Join Date: Mar 2010
Device: Sony PRS-T1, PRS-600 & Nook STR
Thank you very much Idolse. This has been bugging me for a long time. I was able to tweak it to my specifications.
Req13 is offline   Reply With Quote
Old 10-04-2010, 11:35 PM   #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: 37,876
Karma: 18755150
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
Quote:
Originally Posted by Req13 View Post
Setting the left and right margins works in the calibre viewer, but it is still aligned left when I view the epub in the Sony Reader Library. I don't have my prs-600 yet, but is that how it will show up on it?
The version of ADE on the 600 does not full justify. You'd need to purchase a 650 to get ePub that allows full justification. Plus, the 650 has the new Pearl screen, is faster, and does not have the touch layer to bother you. So if you can, cancel the 600 and get a 650.
JSWolf is offline   Reply With Quote
Old 10-06-2010, 04:09 AM   #13
Req13
Member
Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!Req13 rocks like Gibraltar!
 
Posts: 20
Karma: 100000
Join Date: Mar 2010
Device: Sony PRS-T1, PRS-600 & Nook STR
Thanks for the info. I wish I could get the 650, but I'm supposed to be receiving the 600 as a prize from Club Bing.
Req13 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Will One Device Rule Them All... Or Not thymaster General Discussions 65 11-23-2010 02:19 PM
Where is the Canadian service centre for 302s? guyanonymous PocketBook 3 09-27-2010 04:37 PM
Rule of Thumb, US Copyright Poppa1956 General Discussions 24 06-23-2010 05:38 AM
UK's Printed Electronics Technology Centre (PETEC) and the Flexible Display Centre ( Dulin's Books News 0 02-18-2010 03:30 PM
Calibre adds horizontal rule before chapters K-Thom Calibre 3 08-01-2009 05:46 PM


All times are GMT -4. The time now is 02:37 PM.


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