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 03-18-2013, 04:25 AM   #1
GrannyGrump
Persnickity Nitpicker
GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.
 
GrannyGrump's Avatar
 
Posts: 565
Karma: 2634542
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
How to constrain Table Width

My search skills have failed, and I can't discover if there is a way to do this, or if it is not supported.

I would like to make a CENTERED paragraph, OR a single-cell table, with a border on all four sides.

If I use Margins: Auto, it displays fine in Sigil, but ADE makes the box the full width of the window. leaving a wide strip of white space down each side of the text. So I guess auto-margins are not supported everywhere.

If I use Width: (ems or percentage here), it comes closer to what I want, but when the reading screen is narrow, it causes the lines to break in unattractive places. Am I stuck with using this method, and using nbsp to force the line-breaks to better places? Also, if I set to a wider width, then again I have the large swatches of white space down each side.

--- PS: I forgot to mention that this is a fairly narrow paragraph, and would display about 20 to 30 characters per line. Another similar one would be only 8 characters.


If I can't find a better method, I guess I might have to give up the idea of borders...

Last edited by GrannyGrump; 03-18-2013 at 04:54 AM. Reason: additional info
GrannyGrump is offline   Reply With Quote
Old 03-18-2013, 06:26 AM   #2
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 3,002
Karma: 3440001
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
According to the specs, auto margins are free to interpret. That results into the fact that this does not work in ADE as desired and expected. The problem is, that centering is only applied to the inline elements. What you can try is the following:

In your stylesheet:
Code:
.wrap {text-align:center}
.center {text-align:center; width: 60%; display:inline-block}
.centerleft {text-align: left; width: 60%; display:inline-block }
In your code:
Code:
<div class="wrap">
<p class="center">Here is some text that should be centered</p>
<p class="centerleft">Here is text that is left aligned in the center. As you can see this is quite nifty.</p>
</div>
I expect that the 'centerleft' example is what you are looking for.
Toxaris is offline   Reply With Quote
Old 03-18-2013, 07:11 AM   #3
mrmikel
Book Twiddler
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 2,086
Karma: 1444487
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
You are not the only one frustrated. I do a lot of non-fiction full of tables. It seems impossible to center it. If you use a trick shown on a Liz Castro blog, it centers, but the table elements break up into odd lines. Anything else leaving it normal doesn't center it.

If you aren't trying to make it for anyone but yourself make the table the width of your device, minus a bit. At least it won't be so obvious. You can control the table width, in one view at least, by changing text size and inserting breaks so the columns aren't overly wide. For your narrow column you can put the border information into each td you want to show. It should not be this hard, but it is, for me anyway.
If I have the original source I use images rather than go through all this. Images I can center.
mrmikel is offline   Reply With Quote
Old 03-18-2013, 09:13 AM   #4
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: 64,006
Karma: 42472847
Join Date: Nov 2006
Location: UK
Device: PW2, iPad Retina Mini, iPhone 4, MS Surface Pro, Kobo H2O, N7
Feel free to shoot me, but the deprecated but still functional "<center>" tag works extremely well for this.

ie:

Code:
<center>
<table width=30% border=1>
<tr> 
<td>This is a centred table</td>
</tr>
</table>
</center>
Try it and see.
HarryT is offline   Reply With Quote
Old 03-18-2013, 11:36 AM   #5
mrmikel
Book Twiddler
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 2,086
Karma: 1444487
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
Since Sigil complains about it I haven't been using it, but it does work and it works fine for my Sony. I will just use it and ignore Flight Crew.
mrmikel is offline   Reply With Quote
Old 03-18-2013, 12:58 PM   #6
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: 64,006
Karma: 42472847
Join Date: Nov 2006
Location: UK
Device: PW2, iPad Retina Mini, iPhone 4, MS Surface Pro, Kobo H2O, N7
Quote:
Originally Posted by mrmikel View Post
Since Sigil complains about it I haven't been using it, but it does work and it works fine for my Sony. I will just use it and ignore Flight Crew.
Yes, this is a case where a practical solution which works is what's important, in my view. "<center>" is deprecated, but I can't imagine any device not supporting it.

But I too generally use an image for a complex table - it's often the most hassle-free way of doing it. The centred table code I posted, though, I've used quite a lot where I want to have a centred paragraph with a border - it's useful in books for things like business cards, signs, notices, etc.
HarryT is offline   Reply With Quote
Old 03-19-2013, 03:21 AM   #7
GrannyGrump
Persnickity Nitpicker
GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.
 
GrannyGrump's Avatar
 
Posts: 565
Karma: 2634542
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
Thank you all for the suggestions. I have done a tiny bit of experimenting.

The problem was mostly that, if I set "width" to a percentage, I could not keep the borders close to the text if the screen width changes, they floated way out to the sides.

Now I have tried setting the width at ems instead of percentage, and using <center> as suggested by Harry, and I think this is as close as I will get to my wishes. I just must make sure I specify enough ems to hold the width of the longest line.

Toxaris, that IS pretty nifty. And if I set the widths narrower, I can have two paragraphs side-by-side. I wish I had known about this before, I know just the project it would have helped.

mrmikel, I have given up trying to center tables. I mostly let them sit left-aligned on the page, and who doesn't like it doesn't have to look. Although I might try using <center> in future.

Thank you all again.
GrannyGrump is offline   Reply With Quote
Old 03-19-2013, 01:52 PM   #8
GMcG
Writer
GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.GMcG ought to be getting tired of karma fortunes by now.
 
GMcG's Avatar
 
Posts: 93
Karma: 556222
Join Date: Mar 2011
Location: Munich, Germany
Device: none
In my example the tables are centered. The border of the cell fits to the text, because the width of the table is only 5% with the text expanding the cell.
To avoid line breaks I have added the <nowrap> attribute to <td> except where I want a line break (in the second table). This is done with <br>.
I don't know what happens if the screen of the device is narrower than the longest line (30 characters). I'm afraid part of the text will be hidden. But then the device would be very (!) small.
The formatting is in old style html, but you can do it in CSS as well.

George
Attached Thumbnails
Click image for larger version

Name:	html-text.jpg
Views:	63
Size:	6.4 KB
ID:	103176  
Attached Files
File Type: txt html-text.txt (733 Bytes, 39 views)
File Type: txt css-text.txt (666 Bytes, 40 views)
GMcG is offline   Reply With Quote
Old 03-19-2013, 11:15 PM   #9
GrannyGrump
Persnickity Nitpicker
GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.
 
GrannyGrump's Avatar
 
Posts: 565
Karma: 2634542
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
Ah, thank you GMcG, the nowrap must be the secret word! This works beautifully!

I still have SO much to learn, it seems like an endless education.
GrannyGrump 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
Constrain Proportions of Cover Image? markjoseph ePub 7 12-31-2010 12:54 PM
Anyone know how to convert a pdf table into a table in Word or HTML? BasilC Workshop 7 06-25-2010 01:02 AM
Page Width kobo2010 Kobo Reader 4 05-10-2010 08:14 PM
Sideway Table in ePub (Rotate table/text) Lapiz ePub 3 01-29-2010 01:11 PM
Forget coffee table books-- how about a kitchen table book? ardeegee Lounge 10 12-02-2009 12:00 PM


All times are GMT -4. The time now is 11:49 PM.


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