diff -aur original/odoc_args.ml patched/odoc_args.ml
--- original/odoc_args.ml	2014-09-14 09:18:23.000000000 +0200
+++ patched/odoc_args.ml	2014-09-14 09:18:23.000000000 +0200
@@ -247,6 +247,7 @@
   "\n\n *** HTML options ***\n";
 
 (* html only options *)
+  "-html5", Arg.Set Odoc_html.html5, M.html5;
   "-all-params", Arg.Set Odoc_html.with_parameter_list, M.with_parameter_list ;
   "-css-style", Arg.String (fun s -> Odoc_html.css_style := Some s), M.css_style ;
   "-index-only", Arg.Set Odoc_html.index_only, M.index_only ;
diff -aur original/odoc_html.ml patched/odoc_html.ml
--- original/odoc_html.ml	2014-09-14 09:18:23.000000000 +0200
+++ patched/odoc_html.ml	2014-09-14 09:18:23.000000000 +0200
@@ -22,6 +22,7 @@
 open Class
 open Module
 
+let html5 = ref false
 let with_parameter_list = ref false
 let css_style = ref None
 let index_only = ref false
@@ -29,6 +30,35 @@
 let html_short_functors = ref false
 let charset = ref "iso-8859-1"
 
+(* HTML 5 / Bootstrap specific elements *)
+let if_html5 x y = if !html5 then x else y
+let doc_type () = if_html5 "<!DOCTYPE html>\n" "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"
+let open_bold       () = if_html5 "<strong>"     "<b>"
+let close_bold      () = if_html5 "</strong>"    "</b>"
+let open_italic     () = if_html5 "<em>"         "<i>"
+let close_italic    () = if_html5 "</em>"        "</i>"
+let open_fixed      () = if_html5 "<tt>"         "<pre>"
+let close_fixed     () = if_html5 "</tt>"        "</pre>"
+let open_sup        () = if_html5 "<sup>"        "<sup class=\"superscript\">"
+let close_sup       () = if_html5 "</sup>"       "</sup>"
+let open_sub        () = if_html5 "<sub>"        "<sub class=\"subscript\">"
+let close_sub       () = if_html5 "</sub>"       "</sub>"
+let open_type       () = if_html5 "<tt class=\"type\">" "<code class=\"type\">"
+let close_type      () = if_html5 "</tt>"        "</code>"
+let new_line        () = if_html5 "\n<br><br>\n" "\n<p>\n"
+let open_container  () = if_html5 "<div class=\"container\" style=\"max-width: 42em;\">"   ""
+let close_container () = if_html5 "</div>"       ""
+let open_row        () = if_html5 "<div class=\"row\">\n" ""
+let close_row       () = if_html5 "</div>\n"     ""
+let empty_row       () = if_html5 "<div class=\"row\">&nbsp;</div>\n" ""
+let bootstrap_files = [
+  "bootstrap.min.css" ;
+  "glyphicons-halflings-regular.eot" ;
+  "glyphicons-halflings-regular.svg" ;
+  "glyphicons-halflings-regular.ttf" ;
+  "glyphicons-halflings-regular.woff"
+]
+let bootstrap_css = "bootstrap.min.css"
 
 (** The functions used for naming files and html marks.*)
 module Naming =
@@ -357,14 +387,14 @@
       bs b "</pre>"
 
     method html_of_Bold b t =
-      bs b "<b>";
+      bs b (open_bold ());
       self#html_of_text b t;
-      bs b "</b>"
+      bs b (close_bold ())
 
     method html_of_Italic b t =
-      bs b "<i>" ;
+      bs b (open_italic ()) ;
       self#html_of_text b t;
-      bs b "</i>"
+      bs b (close_italic ())
 
     method html_of_Emphasize b t =
       bs b "<em>" ;
@@ -400,7 +430,7 @@
         tl;
       bs b "</OL>\n"
 
-    method html_of_Newline b = bs b "\n<p>\n"
+    method html_of_Newline b = bs b (new_line ())
 
     method html_of_Block b t =
       bs b "<blockquote>\n";
@@ -472,19 +502,20 @@
           bs b "</a>"
 
     method html_of_Superscript b t =
-      bs b "<sup class=\"superscript\">";
-      self#html_of_text b t;
-      bs b "</sup>"
+        bs b (open_sup ());
+        self#html_of_text b t;
+        bs b (close_sup ())
 
     method html_of_Subscript b t =
-      bs b "<sub class=\"subscript\">";
+      bs b (open_sub ());
       self#html_of_text b t;
-      bs b "</sub>"
+      bs b (close_sub ())
 
     method virtual html_of_info_first_sentence : _
 
     method html_of_Module_list b l =
-      bs b "<br>\n<table class=\"indextable\">\n";
+      bs b (if_html5 "<br>\n<table class=\"table table-striped table-condensed table-hover\">\n"
+                     "<br>\n<table class=\"indextable\">\n");
       List.iter
         (fun name ->
           bs b "<tr><td class=\"module\">";
@@ -562,7 +593,7 @@
       match l with
         [] -> ()
       | _ ->
-          bp b "<b>%s:</b> " Odoc_messages.authors;
+          bp b "%s%s:%s " (open_bold ()) Odoc_messages.authors (close_bold ());
           self#html_of_text b [Raw (String.concat ", " l)];
           bs b "<br>\n"
 
@@ -571,7 +602,7 @@
       match v_opt with
         None -> ()
       | Some v ->
-           bp b "<b>%s:</b> " Odoc_messages.version;
+           bp b "%s%s:%s " (open_bold ()) Odoc_messages.version (close_bold ());
            self#html_of_text b [Raw v];
            bs b "<br>\n"
 
@@ -580,16 +611,16 @@
       match s_opt with
         None -> ()
       | Some s ->
-          bp b "<b>%s</b> " Odoc_messages.since;
+          bp b "%s%s%s " (open_bold ()) Odoc_messages.since (close_bold ());
           self#html_of_text b [Raw s];
           bs b "<br>\n"
 
     (** Print html code for the given "before" information.*)
     method html_of_before b l =
       let f (v, text) =
-        bp b "<b>%s " Odoc_messages.before;
+        bp b "%s%s " (open_bold ()) Odoc_messages.before;
         self#html_of_text b [Raw v];
-        bs b " </b> ";
+        bp b " %s "(close_bold ());
         self#html_of_text b text;
         bs b "<br>\n"
       in
@@ -600,13 +631,15 @@
       match l with
         [] -> ()
       | (s, t) :: [] ->
-          bp b "<b>%s</b> <code>%s</code> "
+          bp b "%s%s%s <code>%s</code> "
+            (open_bold ())
             Odoc_messages.raises
+            (close_bold ())
             s;
           self#html_of_text b t;
           bs b "<br>\n"
       | _ ->
-          bp b "<b>%s</b><ul>" Odoc_messages.raises;
+          bp b "%s%s%s<ul>" (open_bold ()) Odoc_messages.raises (close_bold ());
           List.iter
             (fun (ex, desc) ->
               bp b "<li><code>%s</code> " ex ;
@@ -631,11 +664,11 @@
       match l with
         [] -> ()
       | see :: [] ->
-          bp b "<b>%s</b> " Odoc_messages.see_also;
+          bp b "%s%s%s " (open_bold ()) Odoc_messages.see_also (close_bold ());
           self#html_of_see b see;
           bs b "<br>\n"
       | _ ->
-          bp b "<b>%s</b><ul>" Odoc_messages.see_also;
+          bp b "%s%s%s<ul>" (open_bold ()) Odoc_messages.see_also (close_bold ());
           List.iter
             (fun see ->
               bs b "<li>" ;
@@ -650,7 +683,7 @@
       match return_opt with
         None -> ()
       | Some s ->
-          bp b "<b>%s</b> " Odoc_messages.returns;
+          bp b "%s%s%s " (open_bold ()) Odoc_messages.returns (close_bold ());
           self#html_of_text b s;
           bs b "<br>\n"
 
@@ -763,7 +796,7 @@
     inherit info
 
     val mutable doctype =
-      "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"
+      doc_type ()
     method character_encoding () =
       Printf.sprintf
         "<meta content=\"text/html; charset=%s\" http-equiv=\"Content-Type\">\n"
@@ -771,86 +804,157 @@
 
     (** The default style options. *)
     val mutable default_style_options =
-      [ ".keyword { font-weight : bold ; color : Red }" ;
-        ".keywordsign { color : #C04600 }" ;
-        ".superscript { font-size : 4 }" ;
-        ".subscript { font-size : 4 }" ;
-        ".comment { color : Green }" ;
-        ".constructor { color : Blue }" ;
-        ".type { color : #5C6585 }" ;
-        ".string { color : Maroon }" ;
-        ".warning { color : Red ; font-weight : bold }" ;
-        ".info { margin-left : 3em; margin-right: 3em }" ;
-        ".param_info { margin-top: 4px; margin-left : 3em; margin-right : 3em }" ;
-        ".code { color : #465F91 ; }" ;
-        ".typetable { border-style : hidden }" ;
-        ".paramstable { border-style : hidden ; padding: 5pt 5pt}" ;
-        "tr { background-color : White }" ;
-        "td.typefieldcomment { background-color : #FFFFFF ; font-size: smaller ;}" ;
-        "div.sig_block {margin-left: 2em}" ;
-        "*:target { background: yellow; }" ;
-
-        "body {font: 13px sans-serif; color: black; text-align: left; padding: 5px; margin: 0}";
-
-        "h1 { font-size : 20pt ; text-align: center; }" ;
-
-        "h2 { font-size : 20pt ; border: 1px solid #000000; "^
-        "margin-top: 5px; margin-bottom: 2px;"^
-        "text-align: center; background-color: #90BDFF ;"^
-        "padding: 2px; }" ;
-
-        "h3 { font-size : 20pt ; border: 1px solid #000000; "^
-        "margin-top: 5px; margin-bottom: 2px;"^
-        "text-align: center; background-color: #90DDFF ;"^
-        "padding: 2px; }" ;
-
-        "h4 { font-size : 20pt ; border: 1px solid #000000; "^
-        "margin-top: 5px; margin-bottom: 2px;"^
-        "text-align: center; background-color: #90EDFF ;"^
-        "padding: 2px; }" ;
-
-        "h5 { font-size : 20pt ; border: 1px solid #000000; "^
-        "margin-top: 5px; margin-bottom: 2px;"^
-        "text-align: center; background-color: #90FDFF ;"^
-        "padding: 2px; }" ;
-
-        "h6 { font-size : 20pt ; border: 1px solid #000000; "^
-        "margin-top: 5px; margin-bottom: 2px;"^
-        "text-align: center; background-color: #90BDFF ; "^
-        "padding: 2px; }" ;
-
-        "div.h7 { font-size : 20pt ; border: 1px solid #000000; "^
-        "margin-top: 5px; margin-bottom: 2px;"^
-        "text-align: center; background-color: #E0FFFF ; "^
-        "padding: 2px; }" ;
-
-        "div.h8 { font-size : 20pt ; border: 1px solid #000000; "^
-        "margin-top: 5px; margin-bottom: 2px;"^
-        "text-align: center; background-color: #F0FFFF ; "^
-        "padding: 2px; }" ;
-
-        "div.h9 { font-size : 20pt ; border: 1px solid #000000; "^
-        "margin-top: 5px; margin-bottom: 2px;"^
-        "text-align: center; background-color: #FFFFFF ; "^
-        "padding: 2px; }" ;
-
-        "a {color: #416DFF; text-decoration: none}";
-        "a:hover {background-color: #ddd; text-decoration: underline}";
-        "pre { margin-bottom: 4px; font-family: monospace; }" ;
-        "pre.verbatim, pre.codepre { }";
-
-        ".indextable {border: 1px #ddd solid; border-collapse: collapse}";
-        ".indextable td, .indextable th {border: 1px #ddd solid; min-width: 80px}";
-        ".indextable td.module {background-color: #eee ;  padding-left: 2px; padding-right: 2px}";
-        ".indextable td.module a {color: 4E6272; text-decoration: none; display: block; width: 100%}";
-        ".indextable td.module a:hover {text-decoration: underline; background-color: transparent}";
-        ".deprecated {color: #888; font-style: italic}" ;
-
-        ".indextable tr td div.info { margin-left: 2px; margin-right: 2px }" ;
-
-        "ul.indexlist { margin-left: 0; padding-left: 0;}";
-        "ul.indexlist li { list-style-type: none ; margin-left: 0; padding-left: 0; }";
-      ]
+      if !html5 then
+        [ ".keyword { font-weight: bold; color: #a94442; }" ; (* Bootstrap "danger" text color *)
+          ".keywordsign { color: #c04600; }" ;
+          (* superscript and subscript classes are replaced by bare <sup> and <sub> *)
+          ".comment { color: #3c763d; }" ; (* Bootstrap "success" text color *)
+          ".constructor { color: #31708f; }" ; (* Bootstrap "info" text color *)
+          ".type { color: #428bca; }" ; (* Bootstrap "primary" text color *)
+          ".string { color: #8a6d3b; }" ; (* Bootstrap "warning" text color *)
+          ".warning { color: #a94442; font-weight: bold; }" ;
+          ".info { margin-left: 3em; margin-right: 3em; }" ;
+          ".param_info { margin-top: 4px; margin-left: 3em; margin-right: 3em; }" ;
+          (* keep default color for "code" *)
+          ".typetable { border-style: hidden; }" ;
+          ".paramstable { border-style: hidden; padding: 5pt 5pt;}" ;
+          "tr { background-color: #ffffff; }" ;
+          "td.typefieldcomment { background-color: #ffffff; font-size: smaller; }" ;
+          "div.sig_block { margin-left: 2em; }" ;
+          "*:target { background: #ffff80; }" ;
+
+          "h1 { text-align: center; }" ;
+
+          "h2 { border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px; "^
+          "text-align: center; background-color: #a3daff; "^
+          "padding: 2px; }" ;
+
+          "h3 { border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px; "^
+          "text-align: center; background-color: #a3daff; "^
+          "padding: 2px; }" ;
+
+          "h4 { font-size: 24px; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px; "^
+          "text-align: center; background-color: #a3daff; "^
+          "padding: 2px; }" ;
+
+          "h5 { font-size: 24px; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px; "^
+          "text-align: center; background-color: #a3daff; "^
+          "padding: 2px; }" ;
+
+          "h6 { font-size: 24px; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px; "^
+          "text-align: center; background-color: #a3daff; "^
+          "padding: 2px; }" ;
+
+          "div.h7 { font-size: 24px; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px; "^
+          "text-align: center; background-color: #a3daff; "^
+          "padding: 2px; }" ;
+
+          "div.h8 { font-size: 24px; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px; "^
+          "text-align: center; background-color: #a3daff; "^
+          "padding: 2px; }" ;
+
+          "div.h9 { font-size: 24px; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px; "^
+          "text-align: center; background-color: #a3daff; "^
+          "padding: 2px; }" ;
+
+          "a { color: #416dff; text-decoration: none; }";
+          "a:hover { text-decoration: underline; }" ;
+          (* keep defaults for <pre> *)
+
+          ".deprecated { color: #808080; font-style: italic; }" ;
+
+          "ul.indexlist { margin-left: 0; padding-left: 0;}" ;
+          "ul.indexlist li { list-style-type: none ; margin-left: 0; padding-left: 0; }" ;
+        ]
+      else
+        [ ".keyword { font-weight : bold ; color : Red }" ;
+          ".keywordsign { color : #C04600 }" ;
+          ".superscript { font-size : 4 }" ;
+          ".subscript { font-size : 4 }" ;
+          ".comment { color : Green }" ;
+          ".constructor { color : Blue }" ;
+          ".type { color : #5C6585 }" ;
+          ".string { color : Maroon }" ;
+          ".warning { color : Red ; font-weight : bold }" ;
+          ".info { margin-left : 3em; margin-right: 3em }" ;
+          ".param_info { margin-top: 4px; margin-left : 3em; margin-right : 3em }" ;
+          ".code { color : #465F91 ; }" ;
+          ".typetable { border-style : hidden }" ;
+          ".paramstable { border-style : hidden ; padding: 5pt 5pt}" ;
+          "tr { background-color : White }" ;
+          "td.typefieldcomment { background-color : #FFFFFF ; font-size: smaller ;}" ;
+          "div.sig_block {margin-left: 2em}" ;
+          "*:target { background: yellow; }" ;
+
+          "body {font: 13px sans-serif; color: black; text-align: left; padding: 5px; margin: 0}";
+
+          "h1 { font-size : 20pt ; text-align: center; }" ;
+
+          "h2 { font-size : 20pt ; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px;"^
+          "text-align: center; background-color: #90BDFF ;"^
+          "padding: 2px; }" ;
+
+          "h3 { font-size : 20pt ; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px;"^
+          "text-align: center; background-color: #90DDFF ;"^
+          "padding: 2px; }" ;
+
+          "h4 { font-size : 20pt ; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px;"^
+          "text-align: center; background-color: #90EDFF ;"^
+          "padding: 2px; }" ;
+
+          "h5 { font-size : 20pt ; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px;"^
+          "text-align: center; background-color: #90FDFF ;"^
+          "padding: 2px; }" ;
+
+          "h6 { font-size : 20pt ; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px;"^
+          "text-align: center; background-color: #90BDFF ; "^
+          "padding: 2px; }" ;
+
+          "div.h7 { font-size : 20pt ; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px;"^
+          "text-align: center; background-color: #E0FFFF ; "^
+          "padding: 2px; }" ;
+
+          "div.h8 { font-size : 20pt ; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px;"^
+          "text-align: center; background-color: #F0FFFF ; "^
+          "padding: 2px; }" ;
+
+          "div.h9 { font-size : 20pt ; border: 1px solid #000000; "^
+          "margin-top: 5px; margin-bottom: 2px;"^
+          "text-align: center; background-color: #FFFFFF ; "^
+          "padding: 2px; }" ;
+
+          "a {color: #416DFF; text-decoration: none}";
+          "a:hover {background-color: #ddd; text-decoration: underline}";
+          "pre { margin-bottom: 4px; font-family: monospace; }" ;
+          "pre.verbatim, pre.codepre { }";
+
+          ".indextable {border: 1px #ddd solid; border-collapse: collapse}";
+          ".indextable td, .indextable th {border: 1px #ddd solid; min-width: 80px}";
+          ".indextable td.module {background-color: #eee ;  padding-left: 2px; padding-right: 2px}";
+          ".indextable td.module a {color: 4E6272; text-decoration: none; display: block; width: 100%}";
+          ".indextable td.module a:hover {text-decoration: underline; background-color: transparent}";
+          ".deprecated {color: #888; font-style: italic}" ;
+
+          ".indextable tr td div.info { margin-left: 2px; margin-right: 2px }" ;
+
+          "ul.indexlist { margin-left: 0; padding-left: 0;}";
+          "ul.indexlist li { list-style-type: none ; margin-left: 0; padding-left: 0; }";
+        ]
 
     (** The style file for all pages. *)
     val mutable style_file = "style.css"
@@ -961,7 +1065,12 @@
       | Some f ->
           style_file <- f
       );
-      style <- "<link rel=\"stylesheet\" href=\""^style_file^"\" type=\"text/css\">\n"
+      let style_sheet href =
+        Printf.sprintf "<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n" href in
+      if !html5 then
+        style <- (style_sheet bootstrap_css) ^ (style_sheet style_file)
+      else
+        style <- style_sheet style_file
 
     (** Get the title given by the user *)
     method title = match !Global.title with None -> "" | Some t -> self#escape t
@@ -1085,24 +1194,32 @@
        match pre with
          None -> ()
        | Some name ->
-           bp b "<a class=\"pre\" href=\"%s\" title=\"%s\">%s</a>\n"
+           bp b "<a class=\"pre\" href=\"%s\" title=\"%s\">%s%s</a>\n"
              (fst (Naming.html_files name))
              name
+             (if_html5 "<span class=\"glyphicon glyphicon-chevron-left\"></span>&nbsp;" "")
              Odoc_messages.previous
       );
       bs b "&nbsp;";
+      if !html5 then bs b "&nbsp;";
       let father = Name.father name in
       let href = if father = "" then self#index else fst (Naming.html_files father) in
       let father_name = if father = "" then "Index" else father in
-      bp b "<a class=\"up\" href=\"%s\" title=\"%s\">%s</a>\n" href father_name Odoc_messages.up;
+      bp b "<a class=\"up\" href=\"%s\" title=\"%s\">%s%s</a>\n"
+        href
+        father_name
+        (if_html5 "<span class=\"glyphicon glyphicon-chevron-up\"></span>&nbsp;" "")
+        Odoc_messages.up;
       bs b "&nbsp;";
+      if !html5 then bs b "&nbsp;";
       (
        match post with
          None -> ()
        | Some name ->
-           bp b "<a class=\"post\" href=\"%s\" title=\"%s\">%s</a>\n"
+           bp b "<a class=\"post\" href=\"%s\" title=\"%s\">%s%s</a>\n"
              (fst (Naming.html_files name))
              name
+             (if_html5 "<span class=\"glyphicon glyphicon-chevron-right\"></span>&nbsp;" "")
              Odoc_messages.next
       );
       bs b "</div>\n"
@@ -1119,10 +1236,18 @@
       try
         let chanout = open_out file in
         let b = new_buf () in
+        bs b (if_html5 doctype "");
         bs b "<html>";
         self#print_header b (self#inner_title in_title);
-        bs b"<body>\n";
+        if !html5 then begin
+          bs b "<style>\n";
+          bs b ".code { background-color: #ffffff; }";
+          bs b "</style>\n";
+        end;
+        bs b "<body>\n";
+        bs b (open_container ());
         self#html_of_code b code;
+        bs b (close_container ());
         bs b "</body></html>";
         Buffer.output_buffer chanout b;
         close_out chanout
@@ -1189,9 +1314,9 @@
     method html_of_type_expr b m_name t =
       let s = Odoc_info.remove_ending_newline (Odoc_info.string_of_type_expr t) in
       let s2 = newline_to_indented_br s in
-      bs b "<code class=\"type\">";
+      bs b (open_type ());
       bs b (self#create_fully_qualified_idents_links m_name s2);
-      bs b "</code>"
+      bs b (close_type ())
 
     (** Print html code to display a [Types.type_expr list]. *)
     method html_of_type_expr_list ?par b m_name sep l =
@@ -1200,47 +1325,52 @@
       print_DEBUG "html#html_of_type_expr_list: 1";
       let s2 = newline_to_indented_br s in
       print_DEBUG "html#html_of_type_expr_list: 2";
-      bs b "<code class=\"type\">";
+      bs b (open_type ());
       bs b (self#create_fully_qualified_idents_links m_name s2);
-      bs b "</code>"
+      bs b (close_type ())
 
     (** Print html code to display a [Types.type_expr list] as type parameters
        of a class of class type. *)
     method html_of_class_type_param_expr_list b m_name l =
       let s = Odoc_info.string_of_class_type_param_list l in
       let s2 = newline_to_indented_br s in
-      bs b "<code class=\"type\">[";
+      bs b (open_type ());
+      bs b "[";
       bs b (self#create_fully_qualified_idents_links m_name s2);
-      bs b "]</code>"
+      bs b "]";
+      bs b (close_type ())
 
     method html_of_class_parameter_list b father c =
       let s = Odoc_info.string_of_class_params c in
       let s = Odoc_info.remove_ending_newline s in
       let s2 = newline_to_indented_br s in
-      bs b "<code class=\"type\">";
+      bs b (open_type ());
       bs b (self#create_fully_qualified_idents_links father s2);
-      bs b "</code>"
+      bs b (close_type ())
 
     (** Print html code to display a list of type parameters for the given type.*)
     method html_of_type_expr_param_list b m_name t =
       let s = Odoc_info.string_of_type_param_list t in
       let s2 = newline_to_indented_br s in
-      bs b "<code class=\"type\">";
+      bs b (open_type ());
       bs b (self#create_fully_qualified_idents_links m_name s2);
-      bs b "</code>"
+      bs b (close_type ())
 
     (** Print html code to display a [Types.module_type]. *)
     method html_of_module_type b ?code m_name t =
       let s = Odoc_info.remove_ending_newline (Odoc_info.string_of_module_type ?code t) in
-      bs b "<code class=\"type\">";
+      bs b (open_type ());
       bs b (self#create_fully_qualified_module_idents_links m_name s);
-      bs b "</code>"
+      bs b (close_type ())
 
     (** Print html code to display the given module kind. *)
     method html_of_module_kind b father ?modu kind =
       match kind with
         Module_struct eles ->
-          self#html_of_text b [Code "sig"];
+          if !html5 then
+            bs b "<tt>sig</tt>"
+          else
+            self#html_of_text b [Code "sig"];
           (
            match modu with
              None ->
@@ -1251,11 +1381,14 @@
                let (html_file, _) = Naming.html_files m.m_name in
                bp b " <a href=\"%s\">..</a> " html_file
           );
-          self#html_of_text b [Code "end"]
+          if !html5 then
+            bs b "<tt>end</tt>"
+          else
+            self#html_of_text b [Code "end"]
       | Module_alias a ->
-          bs b "<code class=\"type\">";
+          bs b (open_type ());
           bs b (self#create_fully_qualified_module_idents_links father a.ma_name);
-          bs b "</code>"
+          bs b (close_type ())
       | Module_functor (p, k) ->
           if !html_short_functors then
             bs b " "
@@ -1276,24 +1409,31 @@
           (* TODO: l'application n'est pas correcte dans un .mli.
              Que faire ? -> afficher le module_type du typedtree  *)
           self#html_of_module_kind b father k1;
-          self#html_of_text b [Code "("];
+          if !html5 then
+            bs b "<tt>(</tt>"
+          else
+            self#html_of_text b [Code "("];
           self#html_of_module_kind b father k2;
-          self#html_of_text b [Code ")"]
+          if !html5 then
+            bs b "<tt>)</tt>"
+          else
+            self#html_of_text b [Code ")"]
       | Module_with (k, s) ->
           (* TODO: modify when Module_with will be more detailed *)
           self#html_of_module_type_kind b father ?modu k;
-          bs b "<code class=\"type\"> ";
+          bs b (open_type ());
           bs b (self#create_fully_qualified_module_idents_links father s);
-          bs b "</code>"
+          bs b (close_type ())
       | Module_constraint (k, tk) ->
           (* TODO: on affiche quoi ? *)
           self#html_of_module_kind b father ?modu k
       | Module_typeof s ->
-          bs b "<code class=\"type\">module type of ";
+          bs b (open_type ());
+          bs b "module type of ";
           bs b (self#create_fully_qualified_module_idents_links father s);
-          bs b "</code>"
+          bs b (close_type ())
       | Module_unpack (code, mta) ->
-          bs b "<code class=\"type\">";
+          bs b (open_type ());
           begin
             match mta.mta_module with
               None ->
@@ -1302,7 +1442,7 @@
                 let (html_file, _) = Naming.html_files mt.mt_name in
                 bp b " <a href=\"%s\">%s</a> " html_file (self#escape code)
           end;
-          bs b "</code>"
+          bs b (close_type ())
 
 
     method html_of_module_parameter b father p =
@@ -1312,14 +1452,28 @@
         else
           "functor ", "-> "
       in
-      self#html_of_text b
-        [
-          Code (s_functor^"(");
-          Code p.mp_name ;
-          Code " : ";
-        ] ;
+      if !html5 then begin
+        bs b "<tt>";
+        bs b s_functor;
+        bs b "(";
+        bs b p.mp_name;
+        bs b " : ";
+        bs b "</tt>"
+      end else
+        self#html_of_text b
+          [
+           Code (s_functor^"(");
+           Code p.mp_name ;
+           Code " : ";
+         ] ;
       self#html_of_module_type_kind b father p.mp_kind;
-      self#html_of_text b [ Code (") "^s_arrow)]
+      if !html5 then begin
+        bs b "<tt>";
+        bs b ") ";
+        bs b s_arrow;
+        bs b "</tt>"
+      end else
+        self#html_of_text b [ Code (") "^s_arrow)]
 
     method html_of_module_element b father ele =
       match ele with
@@ -1346,7 +1500,10 @@
     method html_of_module_type_kind b father ?modu ?mt kind =
       match kind with
         Module_type_struct eles ->
-          self#html_of_text b [Code "sig"];
+          if !html5 then
+            bs b "<tt>sig</tt>"
+          else
+            self#html_of_text b [Code "sig"];
           (
            match mt with
              None ->
@@ -1364,23 +1521,27 @@
                let (html_file, _) = Naming.html_files mt.mt_name in
                bp b " <a href=\"%s\">..</a> " html_file
           );
-          self#html_of_text b [Code "end"]
+          if !html5 then
+            bs b "<tt>end</tt>"
+          else
+            self#html_of_text b [Code "end"]
       | Module_type_functor (p, k) ->
           self#html_of_module_parameter b father p;
           self#html_of_module_type_kind b father ?modu ?mt k
       | Module_type_alias a ->
-          bs b "<code class=\"type\">";
+          bs b (open_type ());
           bs b (self#create_fully_qualified_module_idents_links father a.mta_name);
-          bs b "</code>"
+          bs b (close_type ())
       | Module_type_with (k, s) ->
           self#html_of_module_type_kind b father ?modu ?mt k;
-          bs b "<code class=\"type\"> ";
+          bs b (open_type ());
           bs b (self#create_fully_qualified_module_idents_links father s);
-          bs b "</code>"
+          bs b (close_type ())
       | Module_type_typeof s ->
-          bs b "<code class=\"type\">module type of ";
+          bs b (open_type ());
+          bs b "module type of ";
           bs b (self#create_fully_qualified_module_idents_links father s);
-          bs b "</code>"
+          bs b (close_type ())
 
     (** Print html code to display the type of a module parameter.. *)
     method html_of_module_parameter_type b m_name p =
@@ -1399,7 +1560,7 @@
     (** Print html code for a value. *)
     method html_of_value b v =
       Odoc_info.reset_type_names ();
-      bs b "\n<pre>" ;
+      bp b "\n%s" (open_fixed ());
       bp b "<span id=\"%s\">" (Naming.value_target v);
       bs b (self#keyword "val");
       bs b " ";
@@ -1414,7 +1575,7 @@
       bs b "</span>";
       bs b " : ";
       self#html_of_type_expr b (Name.father v.val_name) v.val_type;
-      bs b "</pre>";
+      bs b (close_fixed ());
       self#html_of_info b v.val_info;
       (
        if !with_parameter_list then
@@ -1426,7 +1587,7 @@
     (** Print html code for an exception. *)
     method html_of_exception b e =
       Odoc_info.reset_type_names ();
-      bs b "\n<pre>";
+      bp b "\n%s" (open_fixed ());
       bp b "<span id=\"%s\">" (Naming.exception_target e);
       bs b (self#keyword "exception");
       bs b " ";
@@ -1452,7 +1613,7 @@
                 bp b "<a href=\"%s\">%s</a>" (Naming.complete_exception_target e) e.ex_name
            )
       );
-      bs b "</pre>\n";
+      bp b "%s\n" (close_fixed ());
       self#html_of_info b e.ex_info
 
     (** Print html code for a type. *)
@@ -1461,12 +1622,12 @@
       let father = Name.father t.ty_name in
       bs b
         (match t.ty_manifest, t.ty_kind with
-          None, Type_abstract -> "\n<pre>"
+          None, Type_abstract -> "\n" ^ (open_fixed ())
         | None, Type_variant _
-        | None, Type_record _ -> "\n<pre><code>"
-        | Some _, Type_abstract -> "\n<pre>"
+        | None, Type_record _ -> "\n"  ^ (if_html5 "<tt><tt>" "<pre><code>")
+        | Some _, Type_abstract -> "\n" ^ (open_fixed ())
         | Some _, Type_variant _
-        | Some _, Type_record _ -> "\n<pre>"
+        | Some _, Type_record _ -> "\n" ^ (open_fixed ())
         );
       bp b "<span id=\"%s\">" (Naming.type_target t);
       bs b ((self#keyword "type")^" ");
@@ -1485,23 +1646,25 @@
            bs b " "
       );
       (match t.ty_kind with
-        Type_abstract -> bs b "</pre>"
+        Type_abstract -> bs b (close_fixed ())
       | Type_variant l ->
           bs b "= ";
           if priv then bs b "private ";
           bs b
             (
              match t.ty_manifest with
-               None -> "</code></pre>"
-             | Some _ -> "</pre>"
+               None -> if_html5 "</tt></tt>" "</code></pre>"
+             | Some _ -> (close_fixed ())
             );
           bs b "<table class=\"typetable\">\n";
           let print_one constr =
             bs b "<tr>\n<td align=\"left\" valign=\"top\" >\n";
-            bs b "<code>";
+            bs b (if_html5 "<tt>" "<code>");
             bs b (self#keyword "|");
-            bs b "</code></td>\n<td align=\"left\" valign=\"top\" >\n";
-            bs b "<code>";
+            bs b (if_html5 "</tt>" "</code>");
+            bs b "</td>\n<td align=\"left\" valign=\"top\" >\n";
+            bs b (if_html5 "<tt>" "<code>");
+            bs b (if_html5 "&nbsp;" "");
             bp b "<span id=\"%s\">%s</span>"
               (Naming.const_target t constr)
               (self#constructor constr.vc_name);
@@ -1520,22 +1683,25 @@
                  bs b (" " ^ (self#keyword "->") ^ " ");
                  self#html_of_type_expr b father r;
             );
-            bs b "</code></td>\n";
+            bs b (if_html5 "</tt>" "</code>");
+            bs b "</td>\n";
             (
              match constr.vc_text with
                None -> ()
              | Some t ->
                  bs b "<td class=\"typefieldcomment\" align=\"left\" valign=\"top\" >";
-                 bs b "<code>";
+                 bs b (if_html5 "<tt>" "<code>");
                  bs b "(*";
-                 bs b "</code></td>";
+                 bs b (if_html5 "</tt>" "</code>");
+                 bs b "</td>";
                  bs b "<td class=\"typefieldcomment\" align=\"left\" valign=\"top\" >";
                  self#html_of_text b t;
                  bs b "</td>";
                  bs b "<td class=\"typefieldcomment\" align=\"left\" valign=\"bottom\" >";
-                 bs b "<code>";
+                 bs b (if_html5 "<tt>" "<code>");
                  bs b "*)";
-                 bs b "</code></td>";
+                 bs b (if_html5 "</tt>" "</code>");
+                 bs b "</td>";
             );
             bs b "\n</tr>"
           in
@@ -1549,33 +1715,37 @@
           bs b
             (
              match t.ty_manifest with
-               None -> "</code></pre>"
-             | Some _ -> "</pre>"
+               None -> if_html5 "</tt></tt>" "</code></pre>"
+             | Some _ -> (close_fixed ())
             );
           bs b "<table class=\"typetable\">\n" ;
           let print_one r =
             bs b "<tr>\n<td align=\"left\" valign=\"top\" >\n";
-            bs b "<code>&nbsp;&nbsp;</code>";
+            bs b (if_html5 "<tt>&nbsp;&nbsp;</tt>"
+                           "<code>&nbsp;&nbsp;</code>");
             bs b "</td>\n<td align=\"left\" valign=\"top\" >\n";
-            bs b "<code>";
+            bs b (if_html5 "<tt>" "<code>");
             if r.rf_mutable then bs b (self#keyword "mutable&nbsp;") ;
             bp b "<span id=\"%s\">%s</span>&nbsp;: "
               (Naming.recfield_target t r)
               r.rf_name;
             self#html_of_type_expr b father r.rf_type;
-            bs b ";</code></td>\n";
+            bs b ";";
+            bs b (if_html5 "</tt>" "</code>");
+            bs b "</td>\n";
             (
              match r.rf_text with
                None -> ()
              | Some t ->
                  bs b "<td class=\"typefieldcomment\" align=\"left\" valign=\"top\" >";
-                 bs b "<code>";
+                 bs b (if_html5 "<tt>" "<code>");
                  bs b "(*";
-                 bs b "</code></td>";
+                 bs b (if_html5 "</tt></td>" "</code></td>");
                  bs b "<td class=\"typefieldcomment\" align=\"left\" valign=\"top\" >";
                  self#html_of_text b t;
                  bs b "</td><td class=\"typefieldcomment\" align=\"left\" valign=\"bottom\" >";
-                 bs b "<code>*)</code></td>";
+                 bs b (if_html5 "<tt>*)</tt></td>"
+                                "<code>*)</code></td>");
             );
             bs b "\n</tr>"
           in
@@ -1589,7 +1759,7 @@
     (** Print html code for a class attribute. *)
     method html_of_attribute b a =
       let module_name = Name.father (Name.father a.att_value.val_name) in
-      bs b "\n<pre>" ;
+      bp b "\n%s" (open_fixed ());
       bp b "<span id=\"%s\">" (Naming.attribute_target a);
       bs b (self#keyword "val");
       bs b " ";
@@ -1615,13 +1785,13 @@
       bs b "</span>";
       bs b " : ";
       self#html_of_type_expr b module_name a.att_value.val_type;
-      bs b "</pre>";
+      bs b (close_fixed ());
       self#html_of_info b a.att_value.val_info
 
     (** Print html code for a class method. *)
     method html_of_method b m =
       let module_name = Name.father (Name.father m.met_value.val_name) in
-      bs b "\n<pre>";
+      bp b "\n%s" (open_fixed ());
       (* html mark *)
       bp b "<span id=\"%s\">" (Naming.method_target m);
      bs b ((self#keyword "method")^" ");
@@ -1638,7 +1808,7 @@
       bs b "</span>";
       bs b " : ";
       self#html_of_type_expr b module_name m.met_value.val_type;
-      bs b "</pre>";
+      bs b (close_fixed ());
       self#html_of_info b m.met_value.val_info;
       (
        if !with_parameter_list then
@@ -1671,9 +1841,9 @@
             match Parameter.desc_by_name p n with
               None -> ()
             | Some t ->
-                bs b "<code>";
+                bs b (if_html5 "<tt>" "<code>");
                 bs b n;
-                bs b "</code> : ";
+                bs b (if_html5 "</tt> : " "</code> : ");
                 self#html_of_text b t
           in
           print_concat b "<br>\n" print_one l2
@@ -1686,9 +1856,9 @@
           bs b "<div class=\"param_info\">";
           bs b "<table border=\"0\" cellpadding=\"3\" width=\"100%\">\n";
           bs b "<tr>\n<td align=\"left\" valign=\"top\" width=\"1%\">";
-          bs b "<b>";
+          bs b (open_bold ());
           bs b Odoc_messages.parameters;
-          bs b ": </b></td>\n" ;
+          bp b ": %s</td>\n" (close_bold ());
           bs b "<td>\n<table class=\"paramstable\">\n";
           let print_one p =
             bs b "<tr>\n<td align=\"center\" valign=\"top\" width=\"15%\" class=\"code\">\n";
@@ -1719,9 +1889,11 @@
           l
       in
       let f p =
-        bs b "<div class=\"param_info\"><code class=\"code\">";
+        bs b "<div class=\"param_info\">";
+        bs b (open_type ());
         bs b (Parameter.complete_name p);
-        bs b "</code> : " ;
+        bs b (close_type ()) ;
+        bs b " : " ;
         self#html_of_parameter_description b p;
         bs b "</div>\n"
       in
@@ -1735,16 +1907,17 @@
       | _ ->
           bs b "<table border=\"0\" cellpadding=\"3\" width=\"100%\">\n";
           bs b "<tr>\n";
-          bs b "<td align=\"left\" valign=\"top\" width=\"1%%\"><b>";
+          bp b "<td align=\"left\" valign=\"top\" width=\"1%%\">%s" (open_bold ());
           bs b Odoc_messages.parameters ;
-          bs b ": </b></td>\n<td>\n";
+          bp b ": %s</td>\n<td>\n" (close_bold ());
           bs b "<table class=\"paramstable\">\n";
           List.iter
             (fun (p, desc_opt) ->
               bs b "<tr>\n";
-              bs b "<td align=\"center\" valign=\"top\" width=\"15%\">\n<code>" ;
+              bs b (if_html5 "<td align=\"center\" valign=\"top\" width=\"15%\">\n<tt>"
+                             "<td align=\"center\" valign=\"top\" width=\"15%\">\n<code>") ;
               bs b p.mp_name;
-              bs b "</code></td>\n" ;
+              bs b (if_html5 "</tt></td>\n" "</code></td>\n") ;
               bs b "<td align=\"center\" valign=\"top\">:</td>\n";
               bs b "<td>" ;
               self#html_of_module_parameter_type b m_name p;
@@ -1765,7 +1938,7 @@
     method html_of_module b ?(info=true) ?(complete=true) ?(with_link=true) m =
       let (html_file, _) = Naming.html_files m.m_name in
       let father = Name.father m.m_name in
-      bs b "\n<pre>";
+      bp b "\n%s" (open_fixed ());
       bs b ((self#keyword "module")^" ");
       (
        if with_link then
@@ -1780,7 +1953,7 @@
        | _ -> bs b ": "
       );
       self#html_of_module_kind b father ~modu: m m.m_kind;
-      bs b "</pre>";
+      bs b (close_fixed ());
       if info then
         (
          if complete then
@@ -1795,7 +1968,7 @@
     method html_of_modtype b ?(info=true) ?(complete=true) ?(with_link=true) mt =
       let (html_file, _) = Naming.html_files mt.mt_name in
       let father = Name.father mt.mt_name in
-      bs b "\n<pre>";
+      bp b "\n%s" (open_fixed ());
       bs b ((self#keyword "module type")^" ");
       (
        if with_link then
@@ -1809,7 +1982,7 @@
           bs b " = ";
           self#html_of_module_type_kind b father ~mt k
       );
-      bs b "</pre>";
+      bs b (close_fixed ());
       if info then
         (
          if complete then
@@ -1822,7 +1995,7 @@
 
     (** Print html code for an included module. *)
     method html_of_included_module b im =
-      bs b "\n<pre>";
+      bp b "\n%s" (open_fixed ());
       bs b ((self#keyword "include")^" ");
       (
        match im.im_module with
@@ -1840,7 +2013,7 @@
            in
            bp b "<a href=\"%s\">%s</a>" file name
       );
-      bs b "</pre>\n";
+      bp b "%s\n" (close_fixed ());
       self#html_of_info b im.im_info
 
     method html_of_class_element b element =
@@ -1855,7 +2028,10 @@
     method html_of_class_kind b father ?cl kind =
       match kind with
         Class_structure (inh, eles) ->
-          self#html_of_text b [Code "object"];
+          if !html5 then
+            bs b "<tt>object</tt>"
+          else
+            self#html_of_text b [Code "object"];
           (
            match cl with
              None ->
@@ -1871,7 +2047,10 @@
                let (html_file, _) = Naming.html_files cl.cl_name in
                bp b " <a href=\"%s\">..</a> " html_file
           );
-          self#html_of_text b [Code "end"]
+          if !html5 then
+            bs b "<tt>end</tt>"
+          else
+            self#html_of_text b [Code "end"]
 
       | Class_apply capp ->
           (* TODO: display final type from typedtree *)
@@ -1885,16 +2064,25 @@
                self#html_of_class_type_param_expr_list b father l;
                bs b " "
           );
-          bs b "<code class=\"type\">";
+          bs b (open_type ());
           bs b (self#create_fully_qualified_idents_links father cco.cco_name);
-          bs b "</code>"
+          bs b (close_type ())
 
       | Class_constraint (ck, ctk) ->
-          self#html_of_text b [Code "( "] ;
+          if !html5 then
+            bs b "<tt>( </tt>"
+          else
+            self#html_of_text b [Code "( "] ;
           self#html_of_class_kind b father ck;
-          self#html_of_text b [Code " : "] ;
+          if !html5 then
+            bs b "<tt> : </tt>"
+          else
+            self#html_of_text b [Code " : "] ;
           self#html_of_class_type_kind b father ctk;
-          self#html_of_text b [Code " )"]
+          if !html5 then
+            bs b "<tt> )</tt>"
+          else
+            self#html_of_text b [Code " )"]
 
     method html_of_class_type_kind b father ?ct kind =
       match kind with
@@ -1906,12 +2094,15 @@
                self#html_of_class_type_param_expr_list b father l;
                bs b " "
           );
-          bs b "<code class=\"type\">";
+          bs b (open_type ());
           bs b (self#create_fully_qualified_idents_links father cta.cta_name);
-          bs b "</code>"
+          bs b (close_type ())
 
       | Class_signature (inh, eles) ->
-          self#html_of_text b [Code "object"];
+          if !html5 then
+            bs b "<tt>object</tt>"
+          else
+            self#html_of_text b [Code "object"];
           (
            match ct with
              None ->
@@ -1926,14 +2117,17 @@
                let (html_file, _) = Naming.html_files ct.clt_name in
                bp b " <a href=\"%s\">..</a> " html_file
           );
-          self#html_of_text b [Code "end"]
+          if !html5 then
+            bs b "<tt>end</tt>"
+          else
+            self#html_of_text b [Code "end"]
 
     (** Print html code for a class. *)
     method html_of_class b ?(complete=true) ?(with_link=true) c =
       let father = Name.father c.cl_name in
       Odoc_info.reset_type_names ();
       let (html_file, _) = Naming.html_files c.cl_name in
-      bs b "\n<pre>";
+      bp b "\n%s" (open_fixed ());
       (* we add a html id, the same as for a type so we can
          go directly here when the class name is used as a type name *)
       bp b "<span name=\"%s\">"
@@ -1966,7 +2160,7 @@
       bs b " : " ;
       self#html_of_class_parameter_list b father c ;
       self#html_of_class_kind b father ~cl: c c.cl_kind;
-      bs b "</pre>" ;
+      bs b (close_fixed ()) ;
       print_DEBUG "html#html_of_class : info" ;
       (
        if complete then
@@ -1980,7 +2174,7 @@
       Odoc_info.reset_type_names ();
       let father = Name.father ct.clt_name in
       let (html_file, _) = Naming.html_files ct.clt_name in
-      bs b "\n<pre>";
+      bp b "\n%s" (open_fixed ());
       (* we add a html id, the same as for a type so we can
          go directly here when the class type name is used as a type name *)
       bp b "<span id=\"%s\">"
@@ -2010,7 +2204,7 @@
       bs b "</span>";
       bs b " = ";
       self#html_of_class_type_kind b father ~ct ct.clt_kind;
-      bs b "</pre>";
+      bs b (close_fixed ());
       (
        if complete then
          self#html_of_info ~cls: "classtype top" ~indent: true
@@ -2123,9 +2317,11 @@
       try
         let chanout = open_out (Filename.concat !Global.target_dir simple_file) in
         let b = new_buf () in
+        bs b (if_html5 doctype "");
         bs b "<html>\n";
         self#print_header b (self#inner_title title);
         bs b "<body>\n";
+        bs b (open_container ());
         self#print_navbar b None None "";
         bs b "<h1>";
         bs b title;
@@ -2157,12 +2353,14 @@
               in
               bs b "<tr><td align=\"left\"><br>";
               bs b s ;
-              bs b "</td></tr>\n" ;
+              bs b "</td><td>&nbsp;</td></tr>\n" ;
               List.iter f_ele l
         in
-        bs b "<table>\n";
+        bs b (if_html5 "<table class=\"table table-condensed table-hover\">\n"
+                       "<table>\n");
         List.iter f_group groups ;
         bs b "</table>\n" ;
+        bs b (close_container ());
         bs b "</body>\n</html>";
         Buffer.output_buffer chanout b;
         close_out chanout
@@ -2200,6 +2398,7 @@
           ~comments: (Class.class_comments cl)
           (self#inner_title cl.cl_name);
         bs b "<body>\n";
+        bs b (open_container ());
         self#print_navbar b pre_name post_name cl.cl_name;
         bs b "<h1>";
         bs b (Odoc_messages.clas^" ");
@@ -2217,6 +2416,7 @@
         (* the various elements *)
         List.iter (self#html_of_class_element b)
           (Class.class_elements ~trans:false cl);
+        bs b (close_container ());
         bs b "</body></html>";
         Buffer.output_buffer chanout b;
         close_out chanout;
@@ -2248,6 +2448,7 @@
           (self#inner_title clt.clt_name);
 
         bs b "<body>\n";
+        bs b (open_container ());
         self#print_navbar b pre_name post_name clt.clt_name;
         bs b "<h1>";
         bs b (Odoc_messages.class_type^" ");
@@ -2263,6 +2464,7 @@
         (* the various elements *)
         List.iter (self#html_of_class_element b)
           (Class.class_type_elements ~trans: false clt);
+        bs b (close_container ());
         bs b "</body></html>";
         Buffer.output_buffer chanout b;
         close_out chanout;
@@ -2293,6 +2495,7 @@
           ~comments: (Module.module_type_comments mt)
           (self#inner_title mt.mt_name);
         bs b "<body>\n";
+        bs b (open_container ());
         self#print_navbar b pre_name post_name mt.mt_name;
         bp b "<h1>";
         bs b (Odoc_messages.module_type^" ");
@@ -2312,9 +2515,14 @@
         bs b "<hr width=\"100%\">\n";
         (* module elements *)
         List.iter
-          (self#html_of_module_element b (Name.father mt.mt_name))
+          (fun x ->
+            bs b (open_row ());
+            self#html_of_module_element b (Name.father mt.mt_name) x;
+            bs b (close_row ());
+            bs b (empty_row ()))
           (Module.module_type_elements mt);
 
+        bs b (close_container ());
         bs b "</body></html>";
         Buffer.output_buffer chanout b;
         close_out chanout;
@@ -2361,6 +2569,7 @@
           ~comments: (Module.module_comments modu)
           (self#inner_title modu.m_name);
         bs b "<body>\n" ;
+        bs b (open_container ());
         self#print_navbar b pre_name post_name modu.m_name ;
         bs b "<h1>";
         if modu.m_text_only then
@@ -2395,9 +2604,14 @@
 
         (* module elements *)
         List.iter
-          (self#html_of_module_element b (Name.father modu.m_name))
+          (fun x ->
+            bs b (open_row ());
+            self#html_of_module_element b (Name.father modu.m_name) x;
+            bs b (close_row ());
+            bs b (empty_row ()))
           (Module.module_elements modu);
 
+        bs b (close_container ());
         bs b "</body></html>";
         Buffer.output_buffer chanout b;
         close_out chanout;
@@ -2439,6 +2653,7 @@
         bs b "<html>\n";
         self#print_header b self#title;
         bs b "<body>\n";
+        bs b (open_container ());
 
         bs b "<h1>";
         bs b title;
@@ -2456,6 +2671,7 @@
                (List.map (fun m -> m.m_name) module_list);
          | Some i -> self#html_of_info ~indent: false b info
         );
+        bs b (close_container ());
         bs b "</body>\n</html>";
         Buffer.output_buffer chanout b;
         close_out chanout
@@ -2608,6 +2824,30 @@
       if not !index_only then
         self#generate_elements self#generate_for_module module_list ;
 
+      (* copy Bootstrap files if needed *)
+      let copy_file src dst =
+        let src = open_in_bin src in
+        let dst = open_out_bin dst in
+        let len = 4096 in
+        let buff = String.create len in
+        let read = ref (input src buff 0 len) in
+        while (!read <> 0) do
+          output dst buff 0 !read;
+          read := input src buff 0 len
+        done;
+        close_in_noerr src;
+        close_out_noerr dst in
+      if !html5 then begin
+        List.iter
+          (fun file ->
+            let ocamldoc_dir = Filename.concat Config.standard_library "ocamldoc" in
+            let bootstrap_dir = Filename.concat ocamldoc_dir "bootstrap" in
+            let src = Filename.concat bootstrap_dir file in
+            let dst = Filename.concat !Global.target_dir file in
+            copy_file src dst)
+          bootstrap_files
+      end;
+
       try
         self#generate_index module_list;
         self#generate_values_index module_list ;
diff -aur original/odoc_messages.ml patched/odoc_messages.ml
--- original/odoc_messages.ml	2014-09-14 09:18:23.000000000 +0200
+++ patched/odoc_messages.ml	2014-09-14 09:18:23.000000000 +0200
@@ -54,6 +54,7 @@
   "\t\tdirectory (for man and HTML generators)"
 let dump = "<file>\tDump collected information into <file>"
 let load = "<file>\tLoad information from <file> ; may be used several times"
+let html5 = "\tUse HTML5 (based on Bootstrap) "^html_only
 let css_style = "<file>\n\t\tUse content of <file> as CSS style definition "^html_only
 let index_only = "\tGenerate index files only "^html_only
 let colorize_code = "\n\t\tColorize code even in documentation pages "^html_only
