html有什么方法怎么实现空格

为什么空格没效果,怎么实现段落开头有空格
用style="text-indent:2em"好像也不行

img

可以使用如下实现空格

 

参考:https://blog.csdn.net/m0_62791728/article/details/124834810

此外,html5中不再支持font标签,建议通过样式来代替。


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        p {text-indent: 2em;}
    </style>
</head>
<body>
<p>你好啊</p>
<p>你好啊</p>
<p>你好啊</p>
</body>
</html>

建议使用padding-left