使用有时不好吗?(Is it sometimes bad to use ?)

系统教程 行业动态 更新时间:2024-06-14 17:03:54
使用有时不好吗?(Is it sometimes bad to use ?)

使用<BR/>标签有时候是不好的?

我问,因为开发团队给我的第一条建议是:不要使用<BR/> ; 而是使用样式。 但为什么? 使用<BR/>标签时是否有负面结果?

Is it sometimes bad to use <BR/> tags?

I ask because some of the first advice my development team gave me was this: Don't use <BR/> ; instead, use styles. But why? Are there negative outcomes when using <BR/> tags?

最满意答案

不使用<br>主要原因是它不是语义 。 如果你想要两个不同的视觉区块,你可能希望它们在不同的逻辑块。

在大多数情况下,这意味着只是使用不同的元素,例如<p>Stuff</p><p>Other stuff</p> ,然后使用CSS将块正确放置。

有些情况下<br>具有语义有效性,即换行符是发送数据的一部分 。 这真的只限于2个用例 - 诗歌和邮寄地址。

The main reason for not using <br> is that it's not semantic. If you want two items in different visual blocks, you probably want them in different logical blocks.

In most cases this means just using different elements, for example <p>Stuff</p><p>Other stuff</p>, and then using CSS to space the blocks out properly.

There are cases where <br> is semantically valid, i.e. cases where the line break is part of the data you're sending. This is really only limited to 2 use cases - poetry and mailing addresses.

更多推荐

本文发布于:2023-04-24 14:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/b7446ac1ee9c6ccedfb9b2035da79268.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:bad

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!