View Single Post
Old 03-22-2011, 05:22 AM   #8
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: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by norway1456 View Post
I have tried everything I can come up with to achive this, from a div where the text is right-aligned containing another div where the text in leftaligned containing my paragraphs to a div floating to the right, but has not succeded in anything better that the idea of a right floating <p> or a <div>.
The problem, I believe, is that block elements don't have a width that adapts to their contents, but use the whole width available. If you add a border to your <div>s and <p>s you'd see what I mean.

You can try assigning a fixed width to your "floating" block (preferably in relative units, such as em). Then you need something else to move it to the right; normal "text-align" does not work because it's for alignment inside the element, not for placement of the element in the page. The proper way would be "margin-left: auto; margin-right: 0", but reading systems are allowed to treat "auto" just like "0", and ADE does, so it might not work either. I guess using a dummy container block with text-align could work:

Code:
<div class="toright">
<p id="block_1">This block is left-aligned,<br/>
but "floated" to the right margin.</p>
</div>
with:

Code:
div.toright { text-align: right; }
div.toright * { text-align: left; }
p#block_1 { width: 20em; }
The width of p#block_1 should be adjusted to the width of its longest line, and every such block appears in the text should have its own name and width.
Jellby is offline   Reply With Quote