Skip to main content
`Ctrl`+`K`

# lxml.html.builder module

A set of HTML generator tags for building HTML documents.

Usage:

    >>> from lxml.html.builder import *
    >>> html = HTML(
    ...            HEAD( TITLE("Hello World") ),
    ...            BODY( CLASS("main"),
    ...                  H1("Hello World !")
    ...            )
    ...        )

    >>> import lxml.etree
    >>> print lxml.etree.tostring(html, pretty_print=True)
    <html>
      <head>
        <title>Hello World</title>
      </head>
      <body class="main">
        <h1>Hello World !</h1>
      </body>
    </html>

lxml.html.builder.CLASS(v)

lxml.html.builder.FOR(v)

lxml.html.builder.A = functools.partial(<lxml.builder.ElementMaker object>, 'a')

  anchor

lxml.html.builder.ABBR = functools.partial(<lxml.builder.ElementMaker object>, 'abbr')

  abbreviated form (e.g., WWW, HTTP, etc.)

lxml.html.builder.ACRONYM = functools.partial(<lxml.builder.ElementMaker object>, 'acronym')

lxml.html.builder.ADDRESS = functools.partial(<lxml.builder.ElementMaker object>, 'address')

  information on author

lxml.html.builder.APPLET = functools.partial(<lxml.builder.ElementMaker object>, 'applet')

  Java applet (DEPRECATED)

lxml.html.builder.AREA = functools.partial(<lxml.builder.ElementMaker object>, 'area')

  client-side image map area

lxml.html.builder.ARTICLE = functools.partial(<lxml.builder.ElementMaker object>, 'article')

  self-contained article

lxml.html.builder.ASIDE = functools.partial(<lxml.builder.ElementMaker object>, 'aside')

  indirectly-related content

lxml.html.builder.AUDIO = functools.partial(<lxml.builder.ElementMaker object>, 'audio')

  embedded audio file

lxml.html.builder.B = functools.partial(<lxml.builder.ElementMaker object>, 'b')

  bold text style

lxml.html.builder.BASE = functools.partial(<lxml.builder.ElementMaker object>, 'base')

  document base URI

lxml.html.builder.BASEFONT = functools.partial(<lxml.builder.ElementMaker object>, 'basefont')

  base font size (DEPRECATED)

lxml.html.builder.BDI = functools.partial(<lxml.builder.ElementMaker object>, 'bdi')

  isolate bidirectional text

lxml.html.builder.BDO = functools.partial(<lxml.builder.ElementMaker object>, 'bdo')

  I18N BiDi over-ride

lxml.html.builder.BIG = functools.partial(<lxml.builder.ElementMaker object>, 'big')

  large text style

lxml.html.builder.BLOCKQUOTE = functools.partial(<lxml.builder.ElementMaker object>, 'blockquote')

  long quotation

lxml.html.builder.BODY = functools.partial(<lxml.builder.ElementMaker object>, 'body')

  document body

lxml.html.builder.BR = functools.partial(<lxml.builder.ElementMaker object>, 'br')

  forced line break

lxml.html.builder.BUTTON = functools.partial(<lxml.builder.ElementMaker object>, 'button')

  push button

lxml.html.builder.CANVAS = functools.partial(<lxml.builder.ElementMaker object>, 'canvas')

  scriptable graphics container

lxml.html.builder.CAPTION = functools.partial(<lxml.builder.ElementMaker object>, 'caption')

  table caption

lxml.html.builder.CENTER = functools.partial(<lxml.builder.ElementMaker object>, 'center')

  shorthand for DIV align=center (DEPRECATED)

lxml.html.builder.CITE = functools.partial(<lxml.builder.ElementMaker object>, 'cite')

  citation

lxml.html.builder.CODE = functools.partial(<lxml.builder.ElementMaker object>, 'code')

  computer code fragment

lxml.html.builder.COL = functools.partial(<lxml.builder.ElementMaker object>, 'col')

  table column

lxml.html.builder.COLGROUP = functools.partial(<lxml.builder.ElementMaker object>, 'colgroup')

  table column group

lxml.html.builder.DATA = functools.partial(<lxml.builder.ElementMaker object>, 'data')

  machine-readable translation

lxml.html.builder.DATALIST = functools.partial(<lxml.builder.ElementMaker object>, 'datalist')

  list of options for an input

lxml.html.builder.DD = functools.partial(<lxml.builder.ElementMaker object>, 'dd')

  definition description

lxml.html.builder.DEL = functools.partial(<lxml.builder.ElementMaker object>, 'del')

  deleted text

lxml.html.builder.DETAILS = functools.partial(<lxml.builder.ElementMaker object>, 'details')

  expandable section

lxml.html.builder.DFN = functools.partial(<lxml.builder.ElementMaker object>, 'dfn')

  instance definition

lxml.html.builder.DIALOG = functools.partial(<lxml.builder.ElementMaker object>, 'dialog')

  dialog box

lxml.html.builder.DIR = functools.partial(<lxml.builder.ElementMaker object>, 'dir')

  directory list (DEPRECATED)

lxml.html.builder.DIV = functools.partial(<lxml.builder.ElementMaker object>, 'div')

  generic language/style container

lxml.html.builder.DL = functools.partial(<lxml.builder.ElementMaker object>, 'dl')

  definition list

lxml.html.builder.DT = functools.partial(<lxml.builder.ElementMaker object>, 'dt')

  definition term

lxml.html.builder.EM = functools.partial(<lxml.builder.ElementMaker object>, 'em')

  emphasis

lxml.html.builder.EMBED = functools.partial(<lxml.builder.ElementMaker object>, 'embed')

  embedded external content

lxml.html.builder.FIELDSET = functools.partial(<lxml.builder.ElementMaker object>, 'fieldset')

  form control group

lxml.html.builder.FIGCAPTION = functools.partial(<lxml.builder.ElementMaker object>, 'figcaption')

  figure caption

lxml.html.builder.FIGURE = functools.partial(<lxml.builder.ElementMaker object>, 'figure')

  self-contained, possibly-captioned content

lxml.html.builder.FONT = functools.partial(<lxml.builder.ElementMaker object>, 'font')

  local change to font (DEPRECATED)

lxml.html.builder.FOOTER = functools.partial(<lxml.builder.ElementMaker object>, 'footer')

  footer for nearest ancestor

lxml.html.builder.FORM = functools.partial(<lxml.builder.ElementMaker object>, 'form')

  interactive form

lxml.html.builder.FRAME = functools.partial(<lxml.builder.ElementMaker object>, 'frame')

  subwindow

lxml.html.builder.FRAMESET = functools.partial(<lxml.builder.ElementMaker object>, 'frameset')

  window subdivision

lxml.html.builder.H1 = functools.partial(<lxml.builder.ElementMaker object>, 'h1')

  heading

lxml.html.builder.H2 = functools.partial(<lxml.builder.ElementMaker object>, 'h2')

  heading

lxml.html.builder.H3 = functools.partial(<lxml.builder.ElementMaker object>, 'h3')

  heading

lxml.html.builder.H4 = functools.partial(<lxml.builder.ElementMaker object>, 'h4')

  heading

lxml.html.builder.H5 = functools.partial(<lxml.builder.ElementMaker object>, 'h5')

  heading

lxml.html.builder.H6 = functools.partial(<lxml.builder.ElementMaker object>, 'h6')

  heading

lxml.html.builder.HEAD = functools.partial(<lxml.builder.ElementMaker object>, 'head')

  document head

lxml.html.builder.HEADER = functools.partial(<lxml.builder.ElementMaker object>, 'header')

  heading content

lxml.html.builder.HGROUP = functools.partial(<lxml.builder.ElementMaker object>, 'hgroup')

  heading group

lxml.html.builder.HR = functools.partial(<lxml.builder.ElementMaker object>, 'hr')

  horizontal rule

lxml.html.builder.HTML = functools.partial(<lxml.builder.ElementMaker object>, 'html')

  document root element

lxml.html.builder.I = functools.partial(<lxml.builder.ElementMaker object>, 'i')

  italic text style

lxml.html.builder.IFRAME = functools.partial(<lxml.builder.ElementMaker object>, 'iframe')

  inline subwindow

lxml.html.builder.IMG = functools.partial(<lxml.builder.ElementMaker object>, 'img')

  Embedded image

lxml.html.builder.INPUT = functools.partial(<lxml.builder.ElementMaker object>, 'input')

  form control

lxml.html.builder.INS = functools.partial(<lxml.builder.ElementMaker object>, 'ins')

  inserted text

lxml.html.builder.ISINDEX = functools.partial(<lxml.builder.ElementMaker object>, 'isindex')

  single line prompt (DEPRECATED)

lxml.html.builder.KBD = functools.partial(<lxml.builder.ElementMaker object>, 'kbd')

  text to be entered by the user

lxml.html.builder.LABEL = functools.partial(<lxml.builder.ElementMaker object>, 'label')

  form field label text

lxml.html.builder.LEGEND = functools.partial(<lxml.builder.ElementMaker object>, 'legend')

  fieldset legend

lxml.html.builder.LI = functools.partial(<lxml.builder.ElementMaker object>, 'li')

  list item

lxml.html.builder.LINK = functools.partial(<lxml.builder.ElementMaker object>, 'link')

  a media-independent link

lxml.html.builder.MAIN = functools.partial(<lxml.builder.ElementMaker object>, 'main')

  main content

lxml.html.builder.MAP = functools.partial(<lxml.builder.ElementMaker object>, 'map')

  client-side image map

lxml.html.builder.MARK = functools.partial(<lxml.builder.ElementMaker object>, 'mark')

  marked/highlighted text

lxml.html.builder.MARQUEE = functools.partial(<lxml.builder.ElementMaker object>, 'marquee')

  scrolling text

lxml.html.builder.MENU = functools.partial(<lxml.builder.ElementMaker object>, 'menu')

  menu list (DEPRECATED)

lxml.html.builder.META = functools.partial(<lxml.builder.ElementMaker object>, 'meta')

  generic metainformation

lxml.html.builder.METER = functools.partial(<lxml.builder.ElementMaker object>, 'meter')

  numerical value display

lxml.html.builder.NAV = functools.partial(<lxml.builder.ElementMaker object>, 'nav')

  navigation section

lxml.html.builder.NOBR = functools.partial(<lxml.builder.ElementMaker object>, 'nobr')

  prevent wrapping

lxml.html.builder.NOFRAMES = functools.partial(<lxml.builder.ElementMaker object>, 'noframes')

  alternate content container for non frame-based rendering

lxml.html.builder.NOSCRIPT = functools.partial(<lxml.builder.ElementMaker object>, 'noscript')

  alternate content container for non script-based rendering

lxml.html.builder.OBJECT = functools.partial(<lxml.builder.ElementMaker object>, 'object')

  generic embedded object

lxml.html.builder.OL = functools.partial(<lxml.builder.ElementMaker object>, 'ol')

  ordered list

lxml.html.builder.OPTGROUP = functools.partial(<lxml.builder.ElementMaker object>, 'optgroup')

  option group

lxml.html.builder.OPTION = functools.partial(<lxml.builder.ElementMaker object>, 'option')

  selectable choice

lxml.html.builder.OUTPUT = functools.partial(<lxml.builder.ElementMaker object>, 'output')

  result of a calculation

lxml.html.builder.P = functools.partial(<lxml.builder.ElementMaker object>, 'p')

  paragraph

lxml.html.builder.PARAM = functools.partial(<lxml.builder.ElementMaker object>, 'param')

  named property value

lxml.html.builder.PICTURE = functools.partial(<lxml.builder.ElementMaker object>, 'picture')

  picture with multiple sources

lxml.html.builder.PORTAL = functools.partial(<lxml.builder.ElementMaker object>, 'portal')

  embedded preview

lxml.html.builder.PRE = functools.partial(<lxml.builder.ElementMaker object>, 'pre')

  preformatted text

lxml.html.builder.PROGRESS = functools.partial(<lxml.builder.ElementMaker object>, 'progress')

  progress bar

lxml.html.builder.Q = functools.partial(<lxml.builder.ElementMaker object>, 'q')

  short inline quotation

lxml.html.builder.RB = functools.partial(<lxml.builder.ElementMaker object>, 'rb')

  ruby base text

lxml.html.builder.RP = functools.partial(<lxml.builder.ElementMaker object>, 'rp')

  ruby parentheses

lxml.html.builder.RT = functools.partial(<lxml.builder.ElementMaker object>, 'rt')

  ruby text component

lxml.html.builder.RTC = functools.partial(<lxml.builder.ElementMaker object>, 'rtc')

  ruby semantic annotation

lxml.html.builder.RUBY = functools.partial(<lxml.builder.ElementMaker object>, 'ruby')

  ruby annotations

lxml.html.builder.S = functools.partial(<lxml.builder.ElementMaker object>, 's')

  strike-through text style (DEPRECATED)

lxml.html.builder.SAMP = functools.partial(<lxml.builder.ElementMaker object>, 'samp')

  sample program output, scripts, etc.

lxml.html.builder.SCRIPT = functools.partial(<lxml.builder.ElementMaker object>, 'script')

  script statements

lxml.html.builder.SEARCH = functools.partial(<lxml.builder.ElementMaker object>, 'search')

  set of form controls for a search

lxml.html.builder.SECTION = functools.partial(<lxml.builder.ElementMaker object>, 'section')

  generic standalone section

lxml.html.builder.SELECT = functools.partial(<lxml.builder.ElementMaker object>, 'select')

  option selector

lxml.html.builder.SLOT = functools.partial(<lxml.builder.ElementMaker object>, 'slot')

  placeholder for JS use

lxml.html.builder.SMALL = functools.partial(<lxml.builder.ElementMaker object>, 'small')

  small text style

lxml.html.builder.SOURCE = functools.partial(<lxml.builder.ElementMaker object>, 'source')

  source for picture/audio/video element

lxml.html.builder.SPAN = functools.partial(<lxml.builder.ElementMaker object>, 'span')

  generic language/style container

lxml.html.builder.STRIKE = functools.partial(<lxml.builder.ElementMaker object>, 'strike')

  strike-through text (DEPRECATED)

lxml.html.builder.STRONG = functools.partial(<lxml.builder.ElementMaker object>, 'strong')

  strong emphasis

lxml.html.builder.STYLE = functools.partial(<lxml.builder.ElementMaker object>, 'style')

  style info

lxml.html.builder.SUB = functools.partial(<lxml.builder.ElementMaker object>, 'sub')

  subscript

lxml.html.builder.SUMMARY = functools.partial(<lxml.builder.ElementMaker object>, 'summary')

  summary for <details>

lxml.html.builder.SUP = functools.partial(<lxml.builder.ElementMaker object>, 'sup')

  superscript

lxml.html.builder.TABLE = functools.partial(<lxml.builder.ElementMaker object>, 'table')

lxml.html.builder.TBODY = functools.partial(<lxml.builder.ElementMaker object>, 'tbody')

  table body

lxml.html.builder.TD = functools.partial(<lxml.builder.ElementMaker object>, 'td')

  table data cell

lxml.html.builder.TEMPLATE = functools.partial(<lxml.builder.ElementMaker object>, 'template')

  fragment for JS use

lxml.html.builder.TEXTAREA = functools.partial(<lxml.builder.ElementMaker object>, 'textarea')

  multi-line text field

lxml.html.builder.TFOOT = functools.partial(<lxml.builder.ElementMaker object>, 'tfoot')

  table footer

lxml.html.builder.TH = functools.partial(<lxml.builder.ElementMaker object>, 'th')

  table header cell

lxml.html.builder.THEAD = functools.partial(<lxml.builder.ElementMaker object>, 'thead')

  table header

lxml.html.builder.TIME = functools.partial(<lxml.builder.ElementMaker object>, 'time')

  date/time

lxml.html.builder.TITLE = functools.partial(<lxml.builder.ElementMaker object>, 'title')

  document title

lxml.html.builder.TR = functools.partial(<lxml.builder.ElementMaker object>, 'tr')

  table row

lxml.html.builder.TRACK = functools.partial(<lxml.builder.ElementMaker object>, 'track')

  audio/video track

lxml.html.builder.TT = functools.partial(<lxml.builder.ElementMaker object>, 'tt')

  teletype or monospaced text style

lxml.html.builder.U = functools.partial(<lxml.builder.ElementMaker object>, 'u')

  underlined text style (DEPRECATED)

lxml.html.builder.UL = functools.partial(<lxml.builder.ElementMaker object>, 'ul')

  unordered list

lxml.html.builder.VAR = functools.partial(<lxml.builder.ElementMaker object>, 'var')

  instance of a variable or program argument

lxml.html.builder.VIDEO = functools.partial(<lxml.builder.ElementMaker object>, 'video')

  embedded video file

lxml.html.builder.WBR = functools.partial(<lxml.builder.ElementMaker object>, 'wbr')

  word break