How do I set the dimensions & position of a fieldset as well as those of the elements within?

Posted on 2005-05-06
Last Modified: 2012-08-13
Hi everyone.

I have a field set as shown in the below code. I already understand how to set the max length of input elements and the max size of the contents.

My question is two-fold. If this is contrary to the rules please advise me and I will divide my questions up.

I would like to understand how to set the length, width and position of the fieldset on the page.  As well as the elements within

Also what are the dimensions of a browser page in terms of pixels? I would like design my page so that the appear the same irrespective of the resolution that they have set their monitor to.

  <label for="Email"><span class="hlY">Email/User</span></label>
  <input type="text" name="Email" maxlength="40" size="20" />
  <br />
  <label for="Pass"><span class="tcO">Password</span></label>
  <input type="password" name="Pass" maxlength="20" size="20" />
  <br />
  <INPUT TYPE=SUBMIT VALUE="Enter" maxlength="20"/>

Many thanks again in advance.

Question by:winbiz

    Assisted Solution

    set an id on the fieldset, and just set it like you'd set anything else.

    <fieldset id="myset">....</fieldset>

    The css would look like this: (goes in the head tag)
    Positioning is trickier. For a full tutorial on CSS positioning go here:
      width: 200px;
    I usually keep my web pages about 750px wide. that way it'll fit in 800X600 with scrolls and border windows.
    LVL 32

    Accepted Solution

    This is one example where the size of the fieldset is set in pixels by use of CSS, and then the fieldset is centered on the screen:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "">


    <style type="text/css">
        margin:0 auto;


    <div class="mainContent">
        <legend>Log on</legend>
                <td><label for="Email"><span class="hlY">Email/User</span></label></td>
                  <td><input type="text" name="Email" maxlength="40" size="20" /></td>
                <td><label for="Pass"><span class="tcO">Password</span></label></td>
                  <td><input type="password" name="Pass" maxlength="20" size="20" /></td>
                  <td></td><td><INPUT TYPE=SUBMIT VALUE="Enter" maxlength="20"/></td>


    Author Comment

    Thank you both.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 for Beginning Beginners

    Are you looking for an efficient introduction to HTML5? Have you tried other HTML5 courses and found them too complex? Do you need just the basics of HTML5 to use with Wordpress or other content management system? If you said yes to any of these questions, this course is for you.

    Suggested Solutions

    Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
    So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
    In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
    In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

    759 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

    13 Experts available now in Live!

    Get 1:1 Help Now