diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
index 660a8475ea386325701afa8b46947fd8c0f99a23..fab6bf8d40b2ee61a59a8b5741f93c4d221b1206 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
@@ -616,14 +616,15 @@ ppInstHead links splice unicode qual mdoc origin orphan no ihd@(InstHead {..}) =
             )
           where
             ptype = keyword "type" <+> typ
-            prhs = maybe noHtml (\t -> equals <+> ppType unicode qual t) rhs
+            prhs = ptype <+> maybe noHtml
+                                   (\t -> equals <+> ppType unicode qual t) rhs
         DataInst dd ->
             ( subInstHead iid pdata
             , mdoc
             , [subFamInstDetails iid pdecl])
           where
             pdata = keyword "data" <+> typ
-            pdecl = ppShortDataDecl False True dd unicode qual
+            pdecl = pdata <+> ppShortDataDecl False True dd unicode qual
   where
     iid = instanceId origin no orphan ihd
     typ = ppAppNameTypes ihdClsName ihdKinds ihdTypes unicode qual
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
index 19de935cdba00eed833224f906c04fcf696869ca..41457f72c55986d63f2c379f011a4b759b1310aa 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
@@ -232,7 +232,7 @@ subFamInstDetails :: String -- ^ Instance unique id (for anchor generation)
                   -> Html   -- ^ Type or data family instance
                   -> Html
 subFamInstDetails iid fi =
-    subInstSection iid << declElem fi
+    subInstSection iid << thediv ! [theclass "src"] << fi
 
 subInstSection :: String -- ^ Instance unique id (for anchor generation)
                -> Html