Reputation: 149
content_tag(:p, "link : ") + content_tag(:p, link_to("abc","www.abc.com"))
This prints
link:
abc
But I want it to print
link: abc
Upvotes: 0
Views: 637
Reputation: 901
Just use display: inline-block
on the element. This is not a Rails issue but a CSS quirk. p is a block element, as in it takes the whole width of the parent unless its inline.
.two p { display: inline-block; }
<div class="one"><p>Hello</p><p>World</p></div>
<div class="two"><p>Hello</p><p>World</p></div>
Upvotes: 0
Reputation: 1784
<p>
(Paragraph) is a block element and it's HTML mechanics (so it always takes the whole width of it's container). It doesn't have any relation to ruby/rails code and you can't achieve it making any changes in ruby code. You can achieve with some hacky CSS solutions. But good solution is to go with inline <span>
tags. It will do what you want. And you can use single <p>
as root element for 2 <span>
Upvotes: 2