diff --git a/editor/base/nsHTMLEditor.cpp b/editor/base/nsHTMLEditor.cpp
index 54c4df2f8b1d..3b4d0c819be8 100644
--- a/editor/base/nsHTMLEditor.cpp
+++ b/editor/base/nsHTMLEditor.cpp
@@ -4687,7 +4687,13 @@ nsHTMLEditor::InsertAsPlaintextQuotation(const nsString& aQuotedText,
// Do this after the insertion, so that
nsCOMPtr preElement (do_QueryInterface(preNode));
if (preElement)
- preElement->SetAttribute(NS_ConvertASCIItoUCS2("_moz_quote"), NS_ConvertASCIItoUCS2("true"));
+ {
+ preElement->SetAttribute(NS_ConvertASCIItoUCS2("_moz_quote"),
+ NS_ConvertASCIItoUCS2("true"));
+ // set style to not have unwanted vertical margins
+ preElement->SetAttribute(NS_ConvertASCIItoUCS2("style"),
+ NS_ConvertASCIItoUCS2("margin: 0 0 0 0px;"));
+ }
// and set the selection inside it:
selection->Collapse(preNode, 0);
diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp
index 54c4df2f8b1d..3b4d0c819be8 100644
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -4687,7 +4687,13 @@ nsHTMLEditor::InsertAsPlaintextQuotation(const nsString& aQuotedText,
// Do this after the insertion, so that
nsCOMPtr preElement (do_QueryInterface(preNode));
if (preElement)
- preElement->SetAttribute(NS_ConvertASCIItoUCS2("_moz_quote"), NS_ConvertASCIItoUCS2("true"));
+ {
+ preElement->SetAttribute(NS_ConvertASCIItoUCS2("_moz_quote"),
+ NS_ConvertASCIItoUCS2("true"));
+ // set style to not have unwanted vertical margins
+ preElement->SetAttribute(NS_ConvertASCIItoUCS2("style"),
+ NS_ConvertASCIItoUCS2("margin: 0 0 0 0px;"));
+ }
// and set the selection inside it:
selection->Collapse(preNode, 0);