Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6009395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:57:52+00:00 2026-05-23T01:57:52+00:00

Usually <legend> text is pretty short so I had no idea this was a

  • 0

Usually <legend> text is pretty short so I had no idea this was a problem until I ran into it yesterday. I was trying and failing to set a 50% width on a <fieldset>, but it wouldn’t work due to long legend text. Either the fieldset won’t be smaller than the legend, or the legend’s width exceeds that of the fieldset.

This doesn’t seem to be an issue in IE8, Chrome, Safari, Opera, and maybe others. It is an issue in Firefox, IE6, and IE7.

Goal: Get text to wrap in a <legend> cross-browser

  • Without setting any fixed widths
  • Hopefully without extra markup
  • Without javascript
  • Any way we can if the above are impossible
  • Without giving up and using a different tag

I’ve seen this post: Getting LEGEND tags to wrap text properly

…But there is only a single answer that uses a <div> with a fixed width inside the legend tag, I can’t actually get it to work (see fiddle), and OP closed with the comment “in the end we gave up”. Googling this subject turns up a whole lot of “not much” as well.

I put up a jsfiddle demo with some CSS I’ve tried. As I said, I’ve never run into this before so I’m baffled that this is so difficult, and I can’t seem to get anything to work. Is it really just impossible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:57:53+00:00Added an answer on May 23, 2026 at 1:57 am

    Adding white-space: normal; to the legend works fine except in IE7 and IE6. Please see this jsfiddle demo

    After playing around a bit with the CSS, I got it work on IE7, IE8, IE9, FF3-4, and Chrome11 by adding a <span> inside the <legend> with the below CSS:

    legend {
        white-space: normal; 
        width: 100%;
        *margin-left: -7px;
    }
    legend span {
        display:block;
        width: 100%;
    }
    

    Please have a look at this jsfiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Usually when I need to fork in C, I do something like this: pid_t
Usually when I build a site, I put all the CSS into one file,
Usually I saw advapi32.dll loaded into the memory, does anyone know what advapi stands
Usually, Django outputs a nice HTML traceback page once something goes wrong. This is
Usually when I upload to S3 storage, I use an AmazonS3Client like this: var
Usually I'm using One-to-many relationship by this way : class Study { static hasMany
usually i simply develop executable (.exe) files of my MATLAB codes by using this
Usually when you send out emails on an iPhone, the text wraps to the
Usually we write this to get the keys and values from a map. Map
Usually when my regex patterns look like this: http://www.microsoft.com/ Then i have to escape

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.