How to arrange two butons side by side in Struts2


Tags: html,css,struts2

Problem :

I am developing a Web page on struts2 If I am correct theme in Struts2 is set such that all the tags will eventually be inside a table so all tags will be aligned one below other.

In My web page i have login page with Submit and Reset button I want both side by side (next each other) rather than in separate line.I Tried googling i got some answer like { display : inline; } in CSS and also { position : float} and theme="simple" in form. Nothing worked

<table><tr><td><s:submit method="CheckUser" value="Login" align="center" /></td><td><s:reset value="Clear" align="center" /></td></tr>

In case if i set i get the 2 buttons(submit+reset) as required but though label="User Id" is given i get only text field without label

<tr><td><s:textfield name="userid" label="User Id" size="25" /></td></tr>
<tr><td><s:password name="password" label="Password" size="25" /></td></tr>

Please do suggest me where I am going wrong and how to get both label to text field and also submit_Reset button side by side



Solution :

Just leave default Struts2 theme, which is xhtml by the way, as it is and change only your <s:submit> and <s:reset> tags adding to them theme attribute with value simple.

<s:form>
  ... 
  <tr>
    <td colspan="2">
      <s:submit value="Login" theme="simple"/>
      <s:reset value="Clear" theme="simple"/>
    </td>
  </tr> 
</s:form> 

    CSS Howto..

    How to center the navigation on a drop down menu?

    How can I Resize & Enlarge an Image (like sprite icons) via CSS 3?

    How to do two border upon one div tag by css or by css3? [duplicate]

    How to align HTML horizontaly using CSS

    How to make columns scroll independently using CSS?

    How to change the background color of the heading from transparent to paint white?

    How to css style flexible elements to match their parents

    How to modify how TinyMCE format text

    How to add external CSS to HTML 'style'

    How to make div expand all the way to the right

    How to: Illustrator graphic to web animation [closed]

    How to make a menu centered using CSS

    How can i get an image inside an li to disregard padding with css

    How to organize user's shares to easily add comments to that particular post?

    How to set an auto minimum width on column with css?

    How to create a full screen div on landing page

    How to set angular json model into css

    How does changing the display attribute in the styling of an element hide/show it?

    CSS or Javascript href hover (or mouseover) showing additional clickable links

    How to apply the grayscale jquery plugin to a background image?

    How can I make an div span the entire width of my screen

    How to Test CSS/HTML/jQuery?

    How to properly apply a css hack for IE11 transition misbehaviour

    How can I display social media icons in a horizontal line instead of vertical row

    Bottom border doesn't show up in Firefox

    How to include (referencing) CSS Javascript jQuery in master page and content (child) page

    How do I turn a string into a “selector”?

    How to force Google's custom search to be responsive?

    how to fit the background image to the containing anchor element?

    How can i get the source of the image in one div to another?