View Full Version : Indent other than em


curiousgeorge
10-05-2012, 12:47 PM
I was curious to know if you cant indent a set size in ems what is the better alternative to:

<p style="text-indent:1.5em;"></p>

Tex2002ans
10-05-2012, 06:11 PM
I believe all of these units can be used:

http://www.w3schools.com/cssref/css_units.asp

The most commonly used units are em, px, and % (same as em. 1em=100%, 1.5em=150%). In ebooks, using em is the recommended way.

Also, hopefully you are aware of CSS styling instead of inline.

More information can be found here:

http://wiki.mobileread.com/wiki/CSS

Using CSS is a much preferred method to styling web pages/books because it provides an easy one stop shop for the entire formatting of your book.

Jellby
10-06-2012, 04:43 AM
The most commonly used units are em, px, and % (same as em. 1em=100%, 1.5em=150%). In ebooks, using em is the recommended way.

Percents and ems are only equivalent when they're used in font sizes (or in line-height, I believe). In margins, indents, widths, etc. they are two very different things. Percent values are measured relative to the container block's width (generally), while ems are referred to the current font size.

Tex2002ans
10-06-2012, 05:37 AM
Percents and ems are only equivalent when they're used in font sizes (or in line-height, I believe). In margins, indents, widths, etc. they are two very different things. Percent values are measured relative to the container block's width (generally), while ems are referred to the current font size.

Hmm I see. Thank you for the clarification... Guess I should have read those wikis more closely as well. :rofl:

JSWolf
10-06-2012, 09:16 AM
Never use a percent for an indent because the size of the indent will change based on the size of the screen. Em is appropriate because it won't change based on the screen size. 1.2em is a very good value to use. Not too little and not too much. 1em is too small and 1.5em is too much.

Jellby
10-07-2012, 03:36 AM
Never use a percent for an indent because the size of the indent will change based on the size of the screen.

So what? It won't change with font size, and maybe that's what the creator wants.

Em is appropriate because it won't change based on the screen size.

But it will change with font size, and depending on the screen/font ratio it may be too large or too small.

I prefer ems too (for me, that is, for the settings I use and for my taste, 1em is not too small), but let others test and decide for themselves. Just remind them that screen sizes can be changed (by changing device, or changing the screen orientation, or changing the margins), and that font sizes can be changed, so relative indents can change too.

curiousgeorge
10-09-2012, 12:28 PM
I believe all of these units can be used:

http://www.w3schools.com/cssref/css_units.asp

The most commonly used units are em, px, and % (same as em. 1em=100%, 1.5em=150%). In ebooks, using em is the recommended way.

Also, hopefully you are aware of CSS styling instead of inline.

More information can be found here:

http://wiki.mobileread.com/wiki/CSS

Using CSS is a much preferred method to styling web pages/books because it provides an easy one stop shop for the entire formatting of your book.

thanks for the info. This was an ebook I was correcting for someone and Ive never used ems before but was under the impression they were used for font height


Percents and ems are only equivalent when they're used in font sizes (or in line-height, I believe). In margins, indents, widths, etc. they are two very different things. Percent values are measured relative to the container block's width (generally), while ems are referred to the current font size.

thanks for the validation


Never use a percent for an indent because the size of the indent will change based on the size of the screen. Em is appropriate because it won't change based on the screen size. 1.2em is a very good value to use. Not too little and not too much. 1em is too small and 1.5em is too much.

well the em is not approaiate because the ebook will not validate based on the em indent


So what? It won't change with font size, and maybe that's what the creator wants.



But it will change with font size, and depending on the screen/font ratio it may be too large or too small.

I prefer ems too (for me, that is, for the settings I use and for my taste, 1em is not too small), but let others test and decide for themselves. Just remind them that screen sizes can be changed (by changing device, or changing the screen orientation, or changing the margins), and that font sizes can be changed, so relative indents can change too.

thanks for the post :thumbsup:

DiapDealer
10-09-2012, 03:38 PM
well the em is not approaiate because the ebook will not validate based on the em indent
What validator are you using? Whether or not you use ems is completely up to you, but em indents certainly shouldn't have any validation issues.

JSWolf
10-09-2012, 07:33 PM
well the em is not appropriate because the ebook will not validate based on the em indent

It will validate using em. What validation program are you using that's buggy enough to not validate valid code?

text-indent: 1.2em;

That is 100% valid CSS in ePub.

curiousgeorge
10-10-2012, 09:40 AM
Found out why it was kicking out all indents. The client had wrote the .html file as

<p style="text-indent:1.5em;">text text<p>text text text<p>more text than</p>

JSWolf
10-11-2012, 12:16 PM
Found out why it was kicking out all indents. The client had wrote the .html file as

<p style="text-indent:1.5em;">text text<p>text text text<p>more text than</p>

That's not even valid code.

curiousgeorge
10-22-2012, 02:56 PM
I know thats not valid code.