哪种方法更适合仅垂直显示 2 个链接?
哪种方法更适合仅垂直显示 2 个链接?在内容页面中(不是导航)。
这个(虽然我不需要子弹)
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a
type specimen book.
</p>
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
</ul>
这个
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a
type specimen book.
</p>
<p><a href="#">Link 1</a></p>
<p><a href="#">Link 2</a></p>
或者这个
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a
type specimen book.
</p>
<p> <a href="#">Link 1</a>
<br />
<a href="#">Link 2</a>
</p>
Which method is preferred to just show 2 links vertically, one over another? in content page (not as a navigation).
This (although i don't need bullets)
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a
type specimen book.
</p>
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
</ul>
this
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a
type specimen book.
</p>
<p><a href="#">Link 1</a></p>
<p><a href="#">Link 2</a></p>
or this
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a
type specimen book.
</p>
<p> <a href="#">Link 1</a>
<br />
<a href="#">Link 2</a>
</p>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您不应该担心使用什么标记来实现演示目的,这就是 CSS 的用途。您上面给出的所有示例都可以轻松地设计为您想要的外观。您需要确定内容是什么并对其进行适当标记。
请记住,标记描述了内容。这是在组中有意义的链接列表吗?然后使用列表,因为该标记描述了相关事物的列表。链接内容是否不相关?那么不要使用列表,因为列表意味着相关性。
由于语义的高度主观性,有时很难确定。话虽这么说,但您确实应该尝试在语义上标记您的内容,然后使用 CSS 来满足任何表示需求。
You shouldn't be worrying about what markup to use for presentational purposes, that is what CSS is for. All of the examples you give above can easily be styled to look however you want. What you need to determine is what the content is and mark it up appropriately.
Remember that the markup describes the content. Is this a list of links that have meaning in a group? Then use a list since that markup describes a list of related things. Are the links unrelated in content? Then don't use a list as a list implies correlation.
Semantics are tough to determine sometimes due to their highly subjective nature. That being said though you should really try to mark up your content semantically and then use CSS for any presentational needs.
IMO,这完全取决于具体情况。如果链接位于菜单中,那么我将使用无序列表方法。如果它们在逻辑上是分开的,那么我会将它们分别放入自己的容器中。如果它们在逻辑上是相关的,但我只想让它们在自己的行上,我可能会使用 CSS 使它们成为块元素,并设置适当的样式。通常我会避免使用 BR 标签。
It entirely depends on the context, IMO. If the links are in a menu, then I would use the unordered list approach. If they are logically separate, then I'd put them each in their own container. If they are logically related but I just want them on their own line I would probably make them block elements with CSS, styled appropriately. Typically I'd avoid the BR tag.
从语义上来说,为了更容易设计样式,我会选择第一个选项。
如果您不需要项目符号点,只需设置没有它们的
LI
样式 (list-style-type:none
)。Semantically, and for easier styling, I would go with the first option.
If you don't want bullet points, just style the
LI
without them (list-style-type:none
).我会说
I would say
我更喜欢列表标签下的那个,对我来说,它是更清晰的代码并且易于在表单上定位。
i'll prefer the one under the list tag, for me it is much cleaner code and easy to position on the form.