diff --git a/src/html.rs b/src/html.rs
index 56d309f..39b5bdc 100644
--- a/src/html.rs
+++ b/src/html.rs
@@ -340,7 +340,8 @@ fn remove_empty_sections(document: &mut Html) {
}
if el
- .next_siblings()
+ .prev_siblings()
+ .chain(el.next_siblings())
.filter_map(ElementRef::wrap)
.all(|e| is_empty_or_whitespace(&e) || HEADERS.matches(&e))
{