views:

2146

answers:

5

The button_to causes a line break before it in HTML. I have found a workaround which will work, but it's hardly ideal, because then the buttons are NOT real buttons. Is there any other way to avoid the line break before the form?

Here's the resulting HTML

<a href="/last_page">Back</a> | 
<form method="post" action="/next_page" class="button-to">
<div><input type="submit" value="Continue" /></div>
</form>

any help from the CSS side or the Rails side would really help!

+1  A: 

Got it from somewhere out there. Happily:

.button-to { display:inline-block;}
Yar
+2  A: 

the button_to creates an HTML < form > element, which is a block element in HTML. If you give the form a class or id, you build your css selector to get the form and use:

form {
display: inline
}
BushyMark
thanks, Rails gives it a class automatically, so your solution works.
Yar
+2  A: 

Ensure the CSS for that div is set to

display: inline;
alex
:) Thank you Daniel
alex
A: 

You still have to specify inline for the div and the form.

div {
  display: inline;
}

.button-to {
  display: inline;
}

Wouldn't it be nicer if class="button-to" was also specified in the div ? or am I missing something ?

Mat Withers
yes, otherwise you affect all your divs, which is definitely a problem-waiting-to-happen...
Yar
or do it by id, of course
Yar
A: 

To only affect button-to class and its inner div:

.button-to {
  display: inline;
}

.button-to div {
  display: inline;
}
Evandro Saroka
That's strange, I've seen that somewhere.
Yar