0

テキストのブロックがあります。左側に20%、右側に30%のマージンを入れたいと思います。CSSを使用してこれを達成するにはどうすればよいですか?

以下は私のコードです:

.style4 {
    float: left;
    margin-left: 20%;
    background-color: #e5e0dd;
    width: 68.1%;
    margin-right: 30%;
    border-left:30%;

    text-align: center;
    font-family: Calibri;
    font-size: small;
}

<div class="style4">
    This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.This is a test.
</div>
4

1 に答える 1

1

ここでは、マージンではなくパディングを行うことを検討していると思います。

padding-left: 20%; padding-right: 30%; 
于 2012-07-05T21:59:11.770 に答える