Font size of table caption won't be changed
diff --git a/R/group_rows.R b/R/group_rows.R
index 3a179b0..1474c17 100644
--- a/R/group_rows.R
+++ b/R/group_rows.R
@@ -56,7 +56,8 @@
   return(out)
 }
 
-group_rows_latex <- function(kable_input, group_label, start_row, end_row, gap_space) {
+group_rows_latex <- function(kable_input, group_label, start_row, end_row,
+                             gap_space) {
   table_info <- magic_mirror(kable_input)
   out <- kable_input
 
diff --git a/R/kable_styling.R b/R/kable_styling.R
index 05a95cc..05ede9c 100644
--- a/R/kable_styling.R
+++ b/R/kable_styling.R
@@ -122,6 +122,10 @@
   if (!is.null(font_size)) {
     kable_xml_style <- c(kable_xml_style,
                          paste0("font-size: ", font_size, "px;"))
+    kable_caption_node <- xml_tpart(kable_xml, "caption")
+    if (!is.null(kable_caption_node)) {
+      xml_attr(kable_caption_node, "style") <- "font-size: initial !important;"
+    }
   }
   if (!full_width) {
     kable_xml_style <- c(kable_xml_style, "width: auto !important;")
diff --git a/R/util.R b/R/util.R
index 50129a7..66ee3be 100644
--- a/R/util.R
+++ b/R/util.R
@@ -36,6 +36,7 @@
 xml_tpart <- function(x, part) {
   xchildren <- xml_children(x)
   children_names <- xml_name(xchildren)
+  if(!part %in% children_names) return(NULL)
   return(xchildren[[which(children_names == part)]])
 }
 
diff --git a/tests/visual_tests/add_indent_and_group_rows_html.Rmd b/tests/visual_tests/add_indent_and_group_rows_html.Rmd
index 609e09a..be8726e 100644
--- a/tests/visual_tests/add_indent_and_group_rows_html.Rmd
+++ b/tests/visual_tests/add_indent_and_group_rows_html.Rmd
@@ -20,8 +20,8 @@
 ```
 
 ```{r}
-kable(dt, format = "html") %>%
-  kable_styling("striped", full_width = F) %>%
+kable(dt, format = "html", caption = "aaa") %>%
+  kable_styling("striped", full_width = F, font_size = 5) %>%
   group_rows("Group 1", 4, 7) %>%
   group_rows("Group 2", 8, 10)
 ```