diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php
index 4a9057e60c..15c5246a0c 100644
--- a/src/PhpWord/Shared/Html.php
+++ b/src/PhpWord/Shared/Html.php
@@ -771,6 +771,14 @@ protected static function parseStyleDeclarations(array $selectors, array $styles
}
$styles['italic'] = $tValue;
+ break;
+ case 'font-variant':
+ $tValue = false;
+ if (preg_match('#small-caps#', $value)) {
+ $tValue = true;
+ }
+ $styles['smallCaps'] = $tValue;
+
break;
case 'margin':
$value = Converter::cssToTwip($value);
diff --git a/tests/PhpWordTests/Shared/HtmlTest.php b/tests/PhpWordTests/Shared/HtmlTest.php
index 7340b219ab..6887c61829 100644
--- a/tests/PhpWordTests/Shared/HtmlTest.php
+++ b/tests/PhpWordTests/Shared/HtmlTest.php
@@ -176,6 +176,21 @@ public function testParseTextDecoration(): void
self::assertEquals('single', $doc->getElementAttribute('/w:document/w:body/w:p/w:r/w:rPr/w:u', 'w:val'));
}
+ /**
+ * Test font-variant style.
+ */
+ public function testParseFontVariant(): void
+ {
+ $html = 'test';
+ $phpWord = new PhpWord();
+ $section = $phpWord->addSection();
+ Html::addHtml($section, $html);
+
+ $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
+ self::assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:rPr/w:smallCaps'));
+ self::assertEquals('1', $doc->getElementAttribute('/w:document/w:body/w:p/w:r/w:rPr/w:smallCaps', 'w:val'));
+ }
+
/**
* Test font.
*/