08-08-2010, 06:41 AM | #1 |
Wizard
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
|
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 |
08-08-2010, 07:19 PM | #2 |
Wizard
Posts: 1,196
Karma: 1281258
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. |
Advert | |
|
08-08-2010, 10:21 PM | #3 |
Guru
Posts: 869
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
|
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%. |
08-09-2010, 04:20 AM | #4 |
Wizard
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
|
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 |
08-09-2010, 05:37 AM | #5 |
frumious Bandersnatch
Posts: 7,533
Karma: 19000001
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.
|
Advert | |
|
08-09-2010, 09:54 PM | #6 |
Zealot
Posts: 112
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. |
08-10-2010, 04:21 AM | #7 |
Wizard
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
|
|
09-07-2010, 10:10 PM | #8 | |
Groupie
Posts: 185
Karma: 1110435
Join Date: Jul 2010
Location: Shanghai, China
Device: Sibrary G5
|
Quote:
--Nathanael |
|
10-04-2010, 03:03 AM | #9 |
Enthusiast
Posts: 28
Karma: 100000
Join Date: Mar 2010
Device: Kindle PW4, 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?
|
10-04-2010, 04:39 AM | #10 |
Wizard
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> Code:
.ruleclass { margin-left: 5em; margin-right: 5em; } hr { height: 3px; background:#505050; } Last edited by ldolse; 10-04-2010 at 04:42 AM. |
10-04-2010, 10:29 PM | #11 |
Enthusiast
Posts: 28
Karma: 100000
Join Date: Mar 2010
Device: Kindle PW4, 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.
|
10-04-2010, 10:35 PM | #12 |
Resident Curmudgeon
Posts: 75,860
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
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.
|
10-06-2010, 03:09 AM | #13 |
Enthusiast
Posts: 28
Karma: 100000
Join Date: Mar 2010
Device: Kindle PW4, 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.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Will One Device Rule Them All... Or Not | thymaster | General Discussions | 65 | 11-23-2010 01:19 PM |
Where is the Canadian service centre for 302s? | guyanonymous | PocketBook | 3 | 09-27-2010 03:37 PM |
Rule of Thumb, US Copyright | Poppa1956 | General Discussions | 24 | 06-23-2010 04:38 AM |
UK's Printed Electronics Technology Centre (PETEC) and the Flexible Display Centre ( | Dulin's Books | News | 0 | 02-18-2010 02:30 PM |
Calibre adds horizontal rule before chapters | K-Thom | Calibre | 3 | 08-01-2009 04:46 PM |