如何增加字体精美图像的边距

Jer*_*phy -1 html css bootstrap-4

图像位于 h1 编辑边距中,h1 仅编辑边距左增加图像左侧的边距。尝试增加 i 元素的边距也没有任何作用,在 i 元素上也没有任何作用。

  <h1 class="display-4"><i class="fas fa-camera-retro"></i>The Image Gallery</h1>
           <p> A bunch of beautiful images that I didn't take</p>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

我想增加相机图标和文本之间的间距。

Web*_*ter 5

只需将mr-3类应用于图标,如下所示:

<h1 class="display-4"><i class="fas fa-camera-retro mr-3"></i>The Image Gallery</h1>
<p> A bunch of beautiful images that I didn't take</p>
Run Code Online (Sandbox Code Playgroud)

mr-3意思是“保证金权利 3 个单位”。

默认情况下,Bootstrap 为您提供 5 个边距和填充类选项,即选择 1 到 5 之间的数字。当然,数字 0 会将内容清零。