|
|
#1 |
|
Member
![]() Posts: 20
Karma: 10
Join Date: Jun 2011
Device: Kindle
|
Left-justified text in a right-justified box
Code:
<div style="float: right">
<p style="text-align: left">First line<br>
Second line</p>
<div>
<p style="clear: both">And back to regular text.</p>
Anyone know why this is happening and/or how I can get it to do what I want? |
|
|
|
|
|
#2 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Might help if you pasted the relevant code/styles applied by Calibre on these tags and their parents after conversion. It would also help to know how you're viewing the converted content. When you get into more complex styling like this you're often dealing with reading system compatibility issues vs Calibre problems.
|
|
|
|
|
Enthusiast
|
|
|
|
#3 | |
|
Member
![]() Posts: 20
Karma: 10
Join Date: Jun 2011
Device: Kindle
|
Quote:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html><head><title>Test case</title></head><body>
<div style="float: right">
<p>This is the first line, a little longer than<br>
The second line.</p>
</div>
</body></html>
When I compile it into a MOBI with Calibre, I just end up with those lines flush left. (I viewed the MOBI in the Kindle emulator and on my Kindle 3.) Here's what the file looks like from the "processed" folder in the debugging folder: Code:
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test case</title>
<meta content="http://www.w3.org/1999/xhtml; charset=utf-8" http-equiv="Content-Type"/><link href="stylesheet.css" type="text/css" rel="stylesheet"/><style type="text/css">
@page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; }</style></head>
<body class="calibre">
<div class="calibre1">
<p class="calibre2">This is the first line, a little longer than<br class="calibre3"/>
The second line.</p>
</div>
</body>
</html>
Code:
@namespace h "http://www.w3.org/1999/xhtml";
.calibre {
display: block;
font-size: 1em;
line-height: 1.2;
margin-bottom: 0;
margin-left: 5pt;
margin-right: 5pt;
margin-top: 0;
padding-left: 0;
padding-right: 0;
page-break-before: always
}
.calibre1 {
float: right
}
.calibre2 {
display: block;
margin-bottom: 1em;
margin-left: 0;
margin-right: 0;
margin-top: 1em
}
.calibre3 {
display: block
}
|
|
|
|
|
|
|
#4 |
|
Creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 22,509
Karma: 2944574
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
MOBI does not support float. You'd could try some table based hackery to get the effect, but support for tables is highly limited in MOBI as well.
__________________
Get calibre Notice to all: I can not provide assistance with DRM removal, for legal reasons, so please do not contact me about it. |
|
|
|
|
|
#5 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,839
Karma: 23400772
Join Date: Jan 2010
Device: Kindle Fire HD, Kindle 2
|
Quote:
You may be able to fudge something up with tables, but tables aren't really recommended for layout purposes with the MOBI format. You could also create an image of left-justified text and then right-align that image (which won't resize when a user changes font sizes). But I would just use a normal justified paragraph and assign a large left margin to push the text to the right. It's about the best you're going to be able to with MOBI.
__________________
“Politics: A strife of interests masquerading as a contest of principles. The conduct of public affairs for private advantage.” Last edited by DiapDealer; 11-15-2011 at 08:46 PM. |
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sony eBookstore - Justified Text? | SCION | Sony Reader | 17 | 09-22-2011 05:30 PM |
| justified text | sovre | Sony Reader | 2 | 07-24-2011 11:29 PM |
| Formatting an eBook - Left justify or Justified | simonroyle | General Discussions | 75 | 10-28-2010 08:58 PM |
| How is smoothly justified text achieved? | polyfragmentiert | ePub | 6 | 11-19-2009 11:13 PM |
| Justified text in ePub? | kiwik | ePub | 5 | 03-07-2009 02:35 PM |