Width of a fieldset

Posted on 2005-05-10
Last Modified: 2008-03-03
By default, a fieldset will use all the horizontal space available, just like table do with a "width: 100%". How can I make sure that my fieldset only uses the space "it needs", just like tables do by default?

E.g. for an example of fieldset that is wider than it needs to be:

Question by:avernet
    LVL 32

    Expert Comment

    There could be better solutions, but if you set a very small size of the fieldset, it will expand automatically.


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "">
        <style type="text/css">
        <legend>THis is my test</legend>
        <h1>this is the content of this fieldset</h1>
    LVL 30

    Expert Comment

    > if you set a very small size of the fieldset, it will expand automatically.
    Not in firefox.  Try your code with a smaller legend and you'll see.

    I guess the only way is to include the textfield in a table...  :(
    LVL 2

    Expert Comment

    The best thing to go would be in pixels instead of percent so <IMG SRC="imagename.ext" width="100" height="100"> That would make a 100 x 100 pixel image.
    LVL 1

    Accepted Solution

    PAQed with points refunded (100)

    EE Admin

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Suggested Solutions

    "I want to put my photos online, but I don't want them stolen.  What settings should I use?" When You Put Photos Online First and foremost, any digital file published on the WWW can be copied, stored, modified, retransmitted, etc.  Remember Naps…
    Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
    In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
    The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now