# Text\_field without newline

**URL:** <https://www.ruby-forum.com/t/text-field-without-newline/108500>\
**Category:** Rails\
**Created:** [July 4, 2007, 5:44am UTC](https://www.ruby-forum.com/t/text-field-without-newline/108500 "2007-07-04T05:44:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oozy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/6bbea6/32.png) [@oozy](https://www.ruby-forum.com/u/oozy)\
**Post date:** [July 4, 2007, 5:44am UTC](https://www.ruby-forum.com/t/text-field-without-newline/108500/1 "2007-07-04T05:44:08Z")

</div>

Hello.

I have a very basic rails question. I’m using \<%=  
form.text\_field :title, :size =\> 40 %\> to create a text field, but it  
always creates a newline after it. Is is possible to create this text  
field so I can enter some text after it on the same line?

Thanks.

---

<div class="post-metadata">

**Author:** ![oozy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/6bbea6/32.png) [@oozy](https://www.ruby-forum.com/u/oozy)\
**Post date:** [July 4, 2007, 6:10am UTC](https://www.ruby-forum.com/t/text-field-without-newline/108500/2 "2007-07-04T06:10:09Z")

</div>

> I have a very basic rails question. I’m using \<%=  
> form.text\_field :title, :size =\> 40 %\> to create a text field, but it  
> always creates a newline after it. Is is possible to create this text  
> field so I can enter some text after it on the same line?

\<%= … -%\>

That dash will suppress the newline.

-philip

---

<div class="post-metadata">

**Author:** ![oozy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/6bbea6/32.png) [@oozy](https://www.ruby-forum.com/u/oozy)\
**Post date:** [July 6, 2007, 9:52pm UTC](https://www.ruby-forum.com/t/text-field-without-newline/108500/3 "2007-07-06T21:52:34Z")

</div>

if you are refering to what you see in the browser it is very well  
possible that’s just the default setting for that browsers rendering.  
If it considers input fields as block elements it will always insert a  
break after it. You can override this with a CSS selector  
input{display: inline}. I think some versions of IE 6 do that. It  
might be the 6 quarter pounders I just ate speaking. But that CSS  
selector might help incase the minus trick \<%= … -%\> Philip  
suggested doesn’t work out for you.
