</p>end%p.intro produces <p class="intro">.intro { } in CSSgem 'haml', '~> 4.0.5'gem 'haml-rails', '~> 0.5.3'Haml
%p.intro
This is my
%strong favorite!
- 3.times do
%em hi
%br
ERB
<p class="intro">
This is my <strong>favorite!</strong>
<% 3.times do %>
<em>hi</em><br>
<% end %>
</p>
HTML
<p class="intro"> This is my <strong>favorite!</strong> <em>hi</em><br> <em>hi</em><br> <em>hi</em><br> </p>
%strong This is %em not okay
%strong This is %em just fine
<div> tag%htmlTagName, e.g., %p for a paragraph##my-div-id →<div id="my-div-id"></div>%table#my-table-id →<table id="my-table-id"></table># on an element once—..my-div-class →<div class="my-div-class"></div>%body#my-body-class →<body class="my-body-class"></body>. multiple times on the same HTML element.class-the-first.second-class.thirdClass →<div class="class-the-first second-class thirdClass"></div>
# and . on the same HTML element#crazy_id.wildClass →<div id="crazy_id" class="wildClass"></div>%p#aNeatID.cool-class →<p id="aNeatID" class="cool-class"></p>%input{type: 'text', value: 'Cats'}%input{'type' => 'text', 'value' => 'Cats'}%a{href: '/page1'} My Link%a{href: '/page1'}
My Link-- in Haml is like <% in ERB== in Haml is like <%= in ERB%input{type: @my_ruby_variable}%input{value: 'neat ' + my_ruby_function()}class and id attributes in curly braces when you need Ruby code for them:%a{class: get_my_css_class(), href: '/page1'}