在单独的行上显示内联内容 [英] Display inline content on separate lines

查看:78
本文介绍了在单独的行上显示内联内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的内容块:

 < div> 
< img src =/ img / sample.pngalt =示例图像>
< span class =colored-text>公司名称< / span>
< em>地址< / em>
< / div>

我希望'公司名称'和'地址'位于不同的行上。



现在我有几种选择:

制作额外的< div> s,在< span> 之间添加一个< br />和< em> 标签以及其他一些解决方案。
添加这种功能的正确方法是什么?

解决方案

你应该做语义上最有意义的事情。一般来说, div 标签是为了表示页面中的某种DIVision。如果你只是简单地列出一个地址,那么这样做是没有意义的。我会亲自在行尾添加一个< br /> ,它会添加一个换行符,而不会对您的内容进行任何形式的语义声明。


I have a simple block with content:

<div>
    <img src="/img/sample.png" alt="Sample image">
    <span class="colored-text">Company name</span>
    <em>Address</em>
</div>

I want 'Company name' and 'Address' to be on separate lines.

And now I have several options available:

Make additional <div>s, add a <br/> tag between the <span> and <em> tags and maybe some other solutions. What is the proper way to add such functionality?

解决方案

You should do what semantically makes the most sense. In general, div tags are meant to represent some kind of DIVision in the page. If you are simply listing an address it doesn't make sense to do this. I would personally use a <br /> at the end of the line which adds a line break without making any kind of semantic statement about your content.

这篇关于在单独的行上显示内联内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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