我有一个文本块。我想在左侧留出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>
答案 0 :(得分:1)
我认为你可能希望在这里做填充而不是边距。
padding-left: 20%; padding-right: 30%;