如何在文本和按钮之间添加空格而不使用 ?
我的意思是,让第一个按钮上的“你好吗”和第二个按钮上的“你好吗”之间不要太靠近。
<p>
How are you doing?
<br />
<br />
<button class='btn btn-default btn-xs pull-left'>
Cancel
</button>
<button class='btn btn-danger btn-xs pull-right'>
Confirm
</button>
<br />
</p>
1条答案
按热度按时间bvjveswy1#
Spacing on web pages can be achieved primarily via the
margin
andpadding
CSS properties.Put simply: padding affects spacing inside your element and margin affects spacing outside your element.
I'd recommend having a quick read of CSS Box Model to get to grips with the subject.
px
em
rem
and even%
.You could set margin top in CSS like so:
You can apply CSS directly to elements like so:
Although I wouldn't suggest making this a habit as it could potentially make maintaining your code significantly more difficult.