Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

CGI::HtmlExtension#caption

caption(align = {}) { || ... }

Generate a Table Caption element as a string.

align can be a string, giving the alignment of the caption (one of top, bottom, left, or right). It can be a hash of all the attributes of the element. Or it can be omitted.

The body of the element is provided by the passed-in no-argument block.

Example
caption("left") { "Capital Cities" }
  # => <CAPTION ALIGN=\"left\">Capital Cities</CAPTION>
See also #blockquote #checkbox #base #checkbox_group also in 3.4 · 3.3 · 3.2 · 3.1