Reputation: 10967
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 .
Upvotes: 0
Views: 1438
Reputation: 24988
Your markup is just missing the compulsory anchor href
attribute. The following would render properly:
<a href="#">
<p>Lorem Ipsum is simply dummy text... ever since the 1500s, </p>
</a>
Upvotes: 0
Reputation: 597
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.
Upvotes: 0