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 回答