如何从css中提供换行符,而不使用< br /&gt ;? [英] How to give line-break from css, without using <br />?

查看:141
本文介绍了如何从css中提供换行符,而不使用< br /&gt ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

输出:

hello
您好吗

hello
How are you

代码

code:

<p>hello <br /> How are you </p>

如何在没有< br />

推荐答案

不可能用同样的HTML结构来区分

Impossible with the same HTML structure, you must have something to distinguish between Hello and How are you.

我建议使用 span ,您将显示为块(实际上就像< div> )。

I suggest using spans that you will then display as blocks (just like a <div> actually).

HTML:

<p><span>hello</span><span>How are you</span></p>

CSS:

p span 
{
    display: block;
}

这篇关于如何从css中提供换行符,而不使用&lt; br /&gt ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆