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 set a relative position/size to the screen for elements in CSS/HTML? [closed]

    how to align buttons in css/html in one line horizontally?

    How much media queries?

    Why won't my background show within div container?

    How to get smaller divs to stack to the right of larger divs?

    How to remove Left property when position: absolute?

    How to auto adjust (stretch) div height and width using jQuery or CSS

    How can I make height: “100%” work cross browser in CSS?

    How to reanimate div with jquery after using css keyframe animation

    How can I vertically centre bullets that bracket headers

    jQuery, CSS: Two divs, how can I make them “show”next to each other?

    Show or hide button text responsively in jQuery Mobile

    CSS: how to move element from one column to another one without changing the html?

    How can i enlarge wesite font-size when used with vw unit for WCAG (accessibility) propeses?

    jQuery / CSS: How to add page breaks dynamically

    How to (and how not to) load a css file that uses @font-face

    How to make bevel and Embosed effect to button in CSS 3 for web-kit based browsers?

    How to load jQuery before CSS code?

    How to get CSS height value (rather than calculated height) in jQuery

    How to make a fixed position centered after zooming the whole website out?

    How to wait a while before adding elements in css? javascript?

    How to use css control to focus on div background when href link clicked

    css “background-image” shows unwanted border, img “src” does not

    How to make all select elements 15px wider?

    How do I get these hover effects but with diamonds instead of circles

    CSS: How to get rid of scroll (except when there's additional content)?

    How do I vertically align my wrapper so it will be centered on a (mobile) screen?

    How find all elements with a specific css property in a div and add a class to div

    How do I expand this CSS list?

    How do I submit suggestions to the CSS spec? [closed]