PDA

View Full Version : slide menu bar + indent



IanMarlowe
08-01-2005, 06:42 AM
hi. Someone has tampered with my site, and changed my formatting. I fixed all of it except one thing: how do I make it so all text inside the <p></p> tags is indented. I had the script, but now I can't remember it...

IanMarlowe
08-01-2005, 08:34 AM
never mind, got it:



<style type="text/css">
p {margin-left: 0.5cm}
</style>

mwinter
08-01-2005, 03:12 PM
how do I make it so all text inside the <p></p> tags is indented.

[...]

<style type="text/css">
p {margin-left: 0.5cm}
</style>Whilst padding and margins may appear similar superficially, they are different: margins shift the border, padding, and content regions of an element, whilst padding alters only the content, separating it from where the border would appear. Also note that padding uses the background of the element, whereas margins are transparent and allow the content beneath to show through.

Centimeters are not appropriate units unless you're producing a print style sheet (or a style sheet for some other fixed-dimension medium). A centimeter on one monitor may look fine, but disproportionate on another. As this is related to text, you should use a font-relative unit such as ex or em.

Mike

IanMarlowe
08-02-2005, 05:20 AM
ex? em? It works fine with cm... are you suggesting that I use pixels?

mwinter
08-02-2005, 02:18 PM
ex?The x-height of a font; literally the height of the letter x, though it generally means the height of any lowercase letter.


em?I forget what this corresponds to. I think it's either the width of a lowercase m or the height of an uppercase M. In any case, in CSS an em is the same as the font-size property, so 1.5em at font-size: 12xx (whatever) is 18xx.


It works fine with cm...For what values of 'fine'? Consider that with my monitor, I have the following equivalences for 1cm at various dimensions:


640x480: 20px
800x600: 25px
1024x768: 32px
1280x1024: 40px
Your indent will get much larger whilst the font size doesn't change. Depending on your monitor size and resolution and the user's size and resolution, your 1cm could be just right, or horribly disproportionate.

Absolute units (centimeters, inches, millimeters, points, and picas) are only useful when you know exactly how large a medium is (like a sheet of paper, for instance). It should be obvious that you can't possibly know this when it comes to monitors as they vary with each model and manufacturer.


are you suggesting that I use pixels?No, otherwise I'd have said, "Use pixels." Find the equivalent size in ex or em units, and use that.

Mike