Search code examples
csswidthanchorfieldset

max-width not working on anchor within fieldset


I'm trying to build a page, whose contents always shall be within the visible width. This worked fine, until I added a fieldset.

For some reason, the anchor text will not break, when the anchor rests in a fieldset. Can anyone tell me
- why?
- how to circumvent this?

Example:

<fieldset>
  <a href="example.com">verylonglinktextthatmakesproblemsinsmallwindows</a>
</fieldset>
<a href="example.com">verylonglinktextthatbreaksmagicallyoutsidethefieldset</a>

Here is a fiddle: https://jsfiddle.net/myngsges/2/


Solution

  • Adding a 'min-width: auto;' seems to do it. Reference: Word-wrap doesn't apply to div inside fieldset in chrome