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
https://forums.phpfreaks.com/topic/292565-how-to-right-align-data-in-a/
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>

 

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 ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.