1content_tag(:div, , class: "home") 2 3<div class="home"> 4</div>
Now that same HTML div tag can be generated as follows.
1tag.div class: 'home' 2 3<div class="home"> 4</div>
Earlier, the tag type was decided by
the positional argument to the
but now we can just call the required tag type on the
We can pass the tag body and attributes in the block format as well.
1<%= tag.div class: 'home' do %> 2 Welcome to Home! 3<% end %> 4 5 6<div class="home"> 7 Welcome to Home! 8</div>
HTML5 compliant by default
tag helper is also HTML 5 compliant by default, such
that it respects HTML5 features such as void elements.
The old syntax of
is still supported but might be deprecated and removed
in future versions of Rails.