margin設定での%指定

<div style="margin-left:5%">

<p style="margin-left:50%">

<div style="margin-left:10%">

<p style="margin-left:7%">

<p style="margin-left:50%">

margin-leftの設定無し

<p style="margin-left:10%">

<p style="margin-left:-10%">

</div>

</div>

*** %は現在のウィンドウ幅(フレームではフレーム幅)から計算される。margin-leftの場合、その計算結果を親タグの左側を基点にしてmarginされる。

htmlsouse.gif (2461 バイト)

<body>
<div style="margin-left:5%;background-color:silver">
    <p><div style=&quot;margin-left:5%&quot;></p>
    <p style="margin-left:50%;background-color:thistle">
        <p style=&quot;margin-left:50%&quot;></p>
<div style="margin-left:10%;background-color:pink">
    <p><div style=&quot;margin-left:10%&quot;></p>
    <p style="margin-left:7%;background-color:lightblue">
        <p style=&quot;margin-left:7%&quot;></p>
    <p style="margin-left:50%;background-color:yellow">
        <p style=&quot;margin-left:50%&quot;></p>
    <p style="background-color:wheat">
        margin-leftの設定無し</p>
    <p style="margin-left:10%;background-color:white">
        <p style=&quot;margin-left:10%&quot;></p>
    <p style="margin-left:-10%;background-color:yellow">
        <p style=&quot;margin-left:-10%&quot;></p>
    <p>&lt;/div&gt;</p>
</div>
    <p>&lt;/div&gt;</p>
</div>

END