Jump to content

How to right align data in a <fieldset>


jamesmargolis

Recommended Posts

 I wish to display a text field with two buttons under it, and I want one of the button on the leftmost part   (that’s very easy because that's the default), and the other on the rightmost part (this I don’t really know how to implement this). I am currently using something like this :
 

<!DOCTYPE html>
      <html>
      <head>
      <title>Title</title>
      </head>
      <body>
       <fieldset>
<input name="words" type="text" id="words" size="60" /><br><br>
<input type="button" id="lb" name="leftbutton" value="leftbutton"  />
   
<input type="button" id="rb" name="rightbutton" value="rightbutton"  />
 </fieldset>


      </body>
      </html>
        


With this kind of code, I can adjust the number of   to make the other button fit on the far right,
but that’s obviously not the right way to do things.
 Perhaps I should use a table ? How ?

 
 

Link to comment
Share on other sites

A <table> will work, but I prefer to use style="float:right;".

 

I recommend always coding the floated nodes as first in the group of nodes so that the floated node will be at the top of its container.

 

<fieldset>
<input name="words" type="text" id="words" size="60" /><br><br>
<input type="button" id="rb" name="rightbutton" value="rightbutton" style="float:right;"  />
<input type="button" id="lb" name="leftbutton" value="leftbutton"  />
</fieldset>
Link to comment
Share on other sites

 

A <table> will work, but I prefer to use style="float:right;".

 

I recommend always coding the floated nodes as first in the group of nodes so that the floated node will be at the top of its container.

<fieldset>
<input name="words" type="text" id="words" size="60" /><br><br>
<input type="button" id="rb" name="rightbutton" value="rightbutton" style="float:right;"  />
<input type="button" id="lb" name="leftbutton" value="leftbutton"  />
</fieldset>

It works. Thanks! There is no way to mark a topic as solved in this forum ?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.