diff --git a/great_tables/gt.py b/great_tables/gt.py index b16611ef6..c38bdfff5 100644 --- a/great_tables/gt.py +++ b/great_tables/gt.py @@ -434,7 +434,7 @@ def _compile_scss(data: GT, id: Optional[str]) -> str: if has_id: compiled_css = re.sub(r"\.gt_", f"#{id} .gt_", compiled_css, 0, re.MULTILINE) compiled_css = re.sub(r"thead", f"#{id} thead", compiled_css, 0, re.MULTILINE) - compiled_css = re.sub(r" p \{", f"#{id} p " + "{", compiled_css, 0, re.MULTILINE) + compiled_css = re.sub(r"^p \{", f"#{id} p " + "{", compiled_css, 0, re.MULTILINE) finalized_css = f"{gt_table_class_str}\n\n{compiled_css}"