Anchor 内的段落无法格式化
在工作时,我弄乱了 HTML,因为我不知道 标签中的
标签没有被格式化。
就像我有:
<a>
<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, </p>
</a>
while working i messed HTML because i did not knew that <p>
tag within <a>
tag does not get formated .
Like if i had :
<a>
<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, </p>
</a>
where <a>
parent width is 200px;
text goes through 200px;
instead of putting New Lines to fit the text inside .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试做
try to make
添加显示:块;到 a 元素修复它。 a 标签默认是内联元素。它并不意味着容纳其他元素,因此 width 属性不会影响它。使用 CSS 使其像块元素一样显示应该可以使宽度等属性正常工作。我在这里有一个关于 jsfiddle 的工作演示。
Adding the display: block; to the a element fixes it. The a tag is an inline element by default. It was not meant to hold other elements and so the width property does not affect it. Using CSS to make it display like a block element should make properties like width work correctly. I've got a working demo on jsfiddle here.
您的标记只是缺少强制锚
href
属性。以下内容将正确呈现:检查一下
Your markup is just missing the compulsory anchor
href
attribute. The following would render properly:Check it out